参照楼主的代码
import time
import hashlib
tick = int(time.time())
appkey = "your_appkey"
callbackurl = "http://localhost"
apptoken = "your_apptoken"
sdata = "appkey=" + appkey
sdata += "&auth_callback=" + callbackurl
sdata += "&time=" + str(tick)
sdata += "&apptoken=" + apptoken
sign = hashlib.md5(sdata.encode(encoding='UTF-8')).hexdigest()
url = "https://api.ilifesmart.com/app/auth.authorize?id=001&"
url += "&appkey=" + appkey
url += "&time=" + str(tick)
url += "&auth_callback=" + callbackurl
url += "&sign=" + sign
url += "&lang=zh"
print(url)
楼主这段代码其实就是把各类参数合成一个登录地址。其实就是:
https://api.ilifesmart.com/app/a ... 01&&appkey=(你的appkey)&time=(时间戳)&auth_callback=http://localhost&sign=(时间生成的Hash值)&lang=zh
登录后,在地址栏显示的就是带有usertoken的跳转地址,把userid和usertoken拷贝下来。
|