Skip to content

Instantly share code, notes, and snippets.

@fantm21
Created September 13, 2018 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fantm21/f296d6b95afcdb311f47f53b9e7b15d8 to your computer and use it in GitHub Desktop.
Save fantm21/f296d6b95afcdb311f47f53b9e7b15d8 to your computer and use it in GitHub Desktop.
liffpyのサンプルコード
# -*- 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