Slide 1

Slide 1 text

Lotify: a python SDK for LINE Notify LINE Developer Relations NiJia Lin 2020.08

Slide 2

Slide 2 text

NiJia Lin • Developer Rela*ons • External Evangelism • Internal Evangelism LINE Technology Evangelist

Slide 3

Slide 3 text

• Introduction • Why I need to create Lotify • Doing SDK details Agenda

Slide 4

Slide 4 text

LINE Notify & Lotify

Slide 5

Slide 5 text

LINE Notify https://notify-bot.line.me/zh_TW/

Slide 6

Slide 6 text

LINE No'fy h"ps://no)fy-bot.line.me/zh_TW/ • Provided by LINE. • One way notify. • LINE official account. • LINE push message to user. • Via OAuth 2.0.

Slide 7

Slide 7 text

LINE Notify https://notify-bot.line.me/zh_TW/ • Provided by LINE. • One way notify. • LINE official account. • LINE push message to user. • Via OAuth 2.0.

Slide 8

Slide 8 text

LINE Notify - example

Slide 9

Slide 9 text

LINE No'fy - example

Slide 10

Slide 10 text

LINE Notify - Type https://notify-bot.line.me/zh_TW/ • Text • Sticker • Image url • Image file

Slide 11

Slide 11 text

LINE Notify Authorize flow https://notify-bot.line.me/doc/en/

Slide 12

Slide 12 text

Lotify workflow h"ps://github.com/louis70109/lo5fy

Slide 13

Slide 13 text

Lotify workflow https://notify-bot.line.me/doc/en/

Slide 14

Slide 14 text

Lo#fy need you star⭐! https://github.com/louis70109/lotify

Slide 15

Slide 15 text

Why I need to create Lotify

Slide 16

Slide 16 text

• Needed a SDK which can let me use it quickly. • Many Pypi packages just do half features. • If I used LINE Notify I need to call normal API again. • Learned good unit test from line-bot-sdk-python Why I need to create Lotify

Slide 17

Slide 17 text

• Needed a SDK which can let me use it quickly. • Many Pypi packages just do half features. • If I used LINE Notify I need to call normal API again. • Learned good unit test from line-bot-sdk-python. Why I need to create Lo/fy

Slide 18

Slide 18 text

Find most star LINE Notify SDK at Pypi & Github https://github.com/louis70109/lotify

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

Hmmm…!

Slide 21

Slide 21 text

• It had many good code. • It could be better: • Unit test. • Functionalize send message type. • No authorization flow: • Link url • Change token • Get status Why I need to create Lotify

Slide 22

Slide 22 text

• Needed a SDK which can let me use it quickly. • Many Pypi packages just do half features. • If I used LINE Notify I need to call normal API again. • Learned good unit test from line-bot-sdk-python. Why I need to create Lotify

Slide 23

Slide 23 text

• Needed a SDK which can let me use it quickly • Many Pypi packages just do half features • If I used LINE No@fy I need to call normal API again • Learned good unit test from line-bot-sdk-python Why I need to create Lotify

Slide 24

Slide 24 text

Why do I need to create Lotify? • Needed a SDK which can let me use it quickly • Many Pypi packages just do half features • If I used LINE No@fy I need to call normal API again • Learned good unit test from line-bot-sdk-python

Slide 25

Slide 25 text

• Needed a SDK which can let me use it quickly. • Many Pypi packages just do half features. • If I used LINE Notify I need to call normal API again. • Learned good unit test by line-bot-sdk-python. Why I need to create Lotify

Slide 26

Slide 26 text

https://github.com/getsentry/responses Mock response correctly

Slide 27

Slide 27 text

• I referenced line-bot-sdk-python unit test. • Authoriza8on flow. • Documenta8on. • It had example : • h?ps://github.com/louis70109/flask-line-no8fy • One click deployment deploy to Heroku. Why I need to create Lotify

Slide 28

Slide 28 text

Doing SDK Details

Slide 29

Slide 29 text

Fully support

Slide 30

Slide 30 text

Fully support

Slide 31

Slide 31 text

Send sticker & image, revoke token, get status…

Slide 32

Slide 32 text

Lo#fy need you star⭐! https://github.com/louis70109/lotify

Slide 33

Slide 33 text

h"ps://github.com/miyakogi/m2r • Read Markdown file from absolute path and transform Markdown to reStructuredText in generate static file flow by m2r package. Package only can reStructuredText

Slide 34

Slide 34 text

But it fixed and I can not restore…? !

Slide 35

Slide 35 text

• Read Markdown file from absolute path and transform Markdown to reStructuredText in generate static file flow by m2r package Version control

Slide 36

Slide 36 text

• Used a single file to control package version, it could be be5er to control. • Input bo5om code in setup.py: Version control

Slide 37

Slide 37 text

• Input variable in setup() version column. • When you upload new version it would read __version__.py automa:cally. • Every modifica:on need to add version number. Version control

Slide 38

Slide 38 text

Version control

Slide 39

Slide 39 text

Version control

Slide 40

Slide 40 text

Pypi upload config

Slide 41

Slide 41 text

Pypi upload config

Slide 42

Slide 42 text

Pypi upload config

Slide 43

Slide 43 text

Pypi upload config

Slide 44

Slide 44 text

h"ps://github.com/louis70109/lo5fy Split requirements environment

Slide 45

Slide 45 text

• It can let contributor use requirements.txt correctly. • If your SDK had different environment pipline, this method would not pollute them. Split requirements environment

Slide 46

Slide 46 text

• It need .travis.yml file to run. • The file can trigger Travis CI. • Nice to have auto test. • Choose your favorite CI platform. Travis

Slide 47

Slide 47 text

• It need .travis.yml file to run • The file can trigger Travis CI • It’s nice to have auto test • Choose your favorite CI pla:orm Travis

Slide 48

Slide 48 text

• It need .travis.yml file to run • The file can trigger Travis CI • It’s nice to have auto test • Choose your favorite CI pla:orm Travis - Badge GitHub Action could catch Travis result once

Slide 49

Slide 49 text

Travis - Badge

Slide 50

Slide 50 text

Travis - Badge

Slide 51

Slide 51 text

Travis - Badge

Slide 52

Slide 52 text

• It need tox.ini file to run. • Check mul3 python version. • Lo3fy was checked 3.5~3.8 • Run Linter(flake8). • CI is suitable. Tox

Slide 53

Slide 53 text

Namespace

Slide 54

Slide 54 text

Namespace

Slide 55

Slide 55 text

• “self” share between Class and Instance level. • Bot_orgin & api_origin can change url, if developer want to Stress testing. Variable level

Slide 56

Slide 56 text

• Credibility & Protec.ve. • Very important !! License

Slide 57

Slide 57 text

Heroku

Slide 58

Slide 58 text

Heroku

Slide 59

Slide 59 text

https://github.com/louis70109/flask-line-notify Try it!

Slide 60

Slide 60 text

• LINE Notify & Lotify flow. • Why I implement Lotify. • What are Lotify have. • Version control. • Pypi upload config. • Requirement file. • Travis & Tox • Namespace & variable level. • Heroku – one click deployment. Arrangement

Slide 61

Slide 61 text

LINE FRESH 2020 校園競賽 https://linefresh.linecorp.com/ 61

Slide 62

Slide 62 text

LINE TECH FRESH https://engineering.linecorp.com/zh-hant/blog/tech-fresh-2020/ 62

Slide 63

Slide 63 text

No content