赞
踩
点击上方蓝色字体,关注我们
前言这几天从后台数据发现很多小伙伴是很想修改步数的,今天哦不!今晚我就教每一个人都能搭建属于自己刷步数的小知识,因为睡不着所以想着今天还没有写文章,尽可能的给大家安排出来!!!
Your college life is still one me
今/日/文/章
第14期
- 外卖券领取大额红包 -
美团/饿了么
最终效果
▲测试截图
ONE
活动教程
教程很简单,是搬自吾爱大神(作者ID:feifeishishuaib)
一、源代码
底层接口用的是小米运动,需要先下载小米运动app注册然后绑定支付宝微信
参考早期的教程
搭建API
腾讯云函数:
https://console.cloud.tencent.com/scf/index
第一步:腾讯云用你的QQ登陆后到控制台点击函数服务,然后新建函数,名字随便取,选择Python3.6 helloword函数模板,然后点击下一步
然后进行下一步,把代码复制进 index.py 文件里
- import requests,time,re,json headers = {
- 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36' } #获取登录codedef get_code(location): code_pattern = re.compile("(?<=access=).*?(?=&)") code = code_pattern.findall(location)[0] #print(code) return code #登录def login(user,password): url1 = "https://api-user.huami.com/registrations/+86" + user + "/tokens" headers = {
- "Content-Type":"application/x-www-form-urlencoded;charset=UTF-8", "User-Agent":"MiFit/4.6.0 (iPhone; iOS 14.0.1; Scale/2.00)" } data1 = {
- "client_id":"HuaMi", "password":f"{password}", "redirect_uri":"https://s3-us-west-2.amazonaws.com/hm-registration/successsignin.html", "token":"access" } r1 = requests.post(url1,data=data1,headers=headers,allow_redirects=False) print(r1.text) location = r1.headers["Location"] #print(location) try: code = get_code(location) except: return 0,0 print("access_code获取成功!") print(code) url2 = "https://account.huami.com/v2/client/login" data2 = {
- "app_name":"com.xiaomi.hm.health", "app_version":"4.6.0", "code":f"{code}", "country_code":"CN", "device_id":"2C8B4939-0CCD-4E94-8CBA-CB8EA6E613A1", "device_model":&
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。