Created
September 13, 2018 14:02
-
-
Save fantm21/f296d6b95afcdb311f47f53b9e7b15d8 to your computer and use it in GitHub Desktop.
liffpyのサンプルコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
from liffpy import ( | |
LineFrontendFramework as LIFF, | |
ErrorResponse | |
) | |
def main(): | |
liff_api = LIFF("YOUR_CHANNEL_ACCESS_TOKEN") | |
try: | |
# If you want to add LIFF app | |
liff_id = liff_api.add( | |
view_type="compact", | |
view_url="https://{YOUR LIFF-SITE}") | |
# 400 Error or 401 Error | |
try: | |
# If you want to update LIFF app | |
liff_api.update(liff_id, | |
view_type="full", | |
view_url="https://{YOUR LIFF-SITE}") | |
except ErrorResponse as err: | |
# 401 Error or 404 Error | |
print(err.message) | |
return | |
except ErrorResponse as err: | |
# 401 Error or 404 Error | |
print(err.message) | |
return | |
try: | |
# If you want to get all LIFF apps | |
apps_info = liff_api.get("compact", "https://{YOUR LIFF-SITE}") | |
for app_info in apps_info: | |
try: | |
# If you want to delete LIFF app | |
liff_api.delete(app_info["liffId"]) | |
except ErrorResponse as err: | |
# 401 Error or 404 Error | |
print(err.message) | |
return | |
except ErrorResponse as err: | |
# 401 Error or 404 Error | |
print(err.message) | |
return | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment