Initial Release

This commit is contained in:
Moe Poi ~ 2018-08-22 20:28:26 +07:00
parent 4029e85d5a
commit 86ce350e5a

38
LiffRegister.py Normal file
View file

@ -0,0 +1,38 @@
import requests, json
# Input Data
clientid = input("Client ID : ")
channelsecret = input("Channel Secret : ")
type = input("Type (full/compact/tall): ")
url = input("URL (SSL): ")
#Phase 1 (Get AuthToken)
host = "https://api.line.me/v2/oauth/accessToken"
headers = {
"Content-Type": "application/x-www-form-urlencoded"
}
data = {
"grant_type": "client_credentials",
"client_id": clientid,
"client_secret": channelsecret
}
req = requests.post(host, data=data, headers=headers)
result = json.loads(req.text)
authToken = result["access_token"]
#Phase2 (Register Liff App)
host = "https://api.line.me/liff/v1/apps"
headers = {
"Authorization": "Bearer " + authToken,
"Content-Type": "application/json"
}
data = {
"view": {
"type": type,
"url": url
}
}
req = requests.post(host, json=data, headers=headers)
result = json.loads(req.text)
liffid = result["liffId"]
print ("Your Liff App : line://app/" + liffid)