Lotify: a python SDK for LINE Notify

Lotify: a python SDK for LINE Notify

COSCUP 2020 day2 (0802) main track session: https://coscup.org/2020/zh-TW/agenda/KNJDWQ

2102a6b8760bd6f57f672805723dd83a?s=128

line_developers_tw

August 02, 2020
Tweet

Transcript

  1. Lotify: a python SDK for LINE Notify LINE Developer Relations

    NiJia Lin 2020.08
  2. NiJia Lin • Developer Rela*ons • External Evangelism • Internal

    Evangelism LINE Technology Evangelist
  3. • Introduction • Why I need to create Lotify •

    Doing SDK details Agenda
  4. LINE Notify & Lotify

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

  6. 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.
  7. 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.
  8. LINE Notify - example

  9. LINE No'fy - example

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

    Image url • Image file
  11. LINE Notify Authorize flow https://notify-bot.line.me/doc/en/

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

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

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

  15. Why I need to create Lotify

  16. • 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
  17. • 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
  18. Find most star LINE Notify SDK at Pypi & Github

    https://github.com/louis70109/lotify
  19. None
  20. Hmmm…!

  21. • 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
  22. • 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
  23. • 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
  24. 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
  25. • 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
  26. https://github.com/getsentry/responses Mock response correctly

  27. • 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
  28. Doing SDK Details

  29. Fully support

  30. Fully support

  31. Send sticker & image, revoke token, get status…

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

  33. 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
  34. But it fixed and I can not restore…? !

  35. • Read Markdown file from absolute path and transform Markdown

    to reStructuredText in generate static file flow by m2r package Version control
  36. • Used a single file to control package version, it

    could be be5er to control. • Input bo5om code in setup.py: Version control
  37. • 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
  38. Version control

  39. Version control

  40. Pypi upload config

  41. Pypi upload config

  42. Pypi upload config

  43. Pypi upload config

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

  45. • It can let contributor use requirements.txt correctly. • If

    your SDK had different environment pipline, this method would not pollute them. Split requirements environment
  46. • It need .travis.yml file to run. • The file

    can trigger Travis CI. • Nice to have auto test. • Choose your favorite CI platform. Travis
  47. • 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
  48. • 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
  49. Travis - Badge

  50. Travis - Badge

  51. Travis - Badge

  52. • 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
  53. Namespace

  54. Namespace

  55. • “self” share between Class and Instance level. • Bot_orgin

    & api_origin can change url, if developer want to Stress testing. Variable level
  56. • Credibility & Protec.ve. • Very important !! License

  57. Heroku

  58. Heroku

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

  60. • 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
  61. LINE FRESH 2020 校園競賽 https://linefresh.linecorp.com/ 61

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

  63. None