吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

搜索
查看: 3295|回复: 86
上一主题 下一主题

[Python] 利用python+云函数搭建自己的修改步数api接口

  [复制链接]
跳转到指定楼层
楼主
feifeishishuaib 发表于 2020-10-24 15:01 回帖奖励
本帖最后由 feifeishishuaib 于 2020-10-24 17:13 编辑

一、源代码
底层接口用的是小米运动,需要先下载小米运动app注册然后绑定支付宝微信


参考之前帖子:利用云函数+Python实现每日自动修改微信支付宝步数并用qq提醒


将之前的源码稍微修改下,去掉机器人提醒功能,用api输入必要的参数,登陆失败或修改失败等返回相应的提示,修改完的代码如下:

[Python] 纯文本查看 复制代码
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'
    }

#获取登录code
def 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":"phone",
        "grant_type":"access_token",
        "third_name":"huami_phone",
        } 
    r2 = requests.post(url2,data=data2,headers=headers).json()
    login_token = r2["token_info"]["login_token"]
    print("login_token获取成功!")
    print(login_token)
    userid = r2["token_info"]["user_id"]
    print("userid获取成功!")
    print(userid)

    return login_token,userid

#主函数
def main_handler(event, context):
    print(event["queryString"])
    try:
        user = str(event["queryString"]["user"])
        password = str(event["queryString"]["password"])
        step = str(event["queryString"]["step"])
    except:
        return "please input user,password,step"
    
    login_token = 0
    login_token,userid = login(user,password)
    if login_token == 0:
        print("登陆失败!")
        return "login fail!"

    t = get_time()
    
    app_token = get_app_token(login_token)

    date = time.strftime("%Y-%m-%d",time.localtime())

    with open('data_json.txt','rt') as f:
        data_json = f.read()
    data_json += date + "\"}]"
    step_pattern = re.compile("12345")
    de_id_pattern = re.compile("321123")
    data_json = de_id_pattern.sub("DA932FFFFE8816E7",data_json)
    data_json = step_pattern.sub(f"{step}",data_json)
    
    url = f'https://api-mifit-cn.huami.com/v1/data/band_data.json?&t={t}'
    head = {
        'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.12(0x17000c2d) NetType/WIFI Language/zh_CN',
        'apptoken': f'{app_token}'
        }
    
    data = {
        'data_json': f'{data_json}',
        'userid': f'{userid}',
        'device_type': '0',
        'last_sync_data_time': '1589917081',
        'last_deviceid': 'DA932FFFFE8816E7',
        }

    response = requests.post(url, data=data, headers=head).json()
    print(response)
    result = f"change step {step}:"+ response['message']
    print(result)
    return result
 
#获取时间戳
def get_time():
    url = 'http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp'
    response = requests.get(url,headers=headers).json()
    t = response['data']['t']
    return t
 
#获取app_token
def get_app_token(login_token):
    url = f"https://account-cn.huami.com/v1/client/app_tokens?app_name=com.xiaomi.hm.health&dn=api-user.huami.com%2Capi-mifit.huami.com%2Capp-analytics.huami.com&login_token={login_token}&os_version=4.1.0"
    response = requests.get(url,headers=headers).json()
    app_token = response['token_info']['app_token']
    print("app_token获取成功!")
    print(app_token)
    return app_token

#main_handler(0,0)



二、搭建api


用的是腾讯云函数:https://console.cloud.tencent.com/scf/index
腾讯云函数每个人函数的调用次数是一个月100万次,对于个人用户来说够用了


第一步:QQ登陆后点击函数服务,然后新建函数,名字随便取,运行环境python3.6,空白模板,然后点击下一步

第二步:先将将代码复制进去,然后再新建一个文件,弹出对话框输入data_json.txt后回车,把以下代码复制进去,然后点击完成

[Asm] 纯文本查看 复制代码
[{"summary":"{\"slp\":{\"ss\":73,\"lt\":304,\"dt\":0,\"st\":1589920140,\"lb\":36,\"dp\":92,\"is\":208,\"rhr\":0,\"stage\":[{\"start\":269,\"stop\":357,\"mode\":2},{\"start\":358,\"stop\":380,\"mode\":3},{\"start\":381,\"stop\":407,\"mode\":2},{\"start\":408,\"stop\":423,\"mode\":3},{\"start\":424,\"stop\":488,\"mode\":2},{\"start\":489,\"stop\":502,\"mode\":3},{\"start\":503,\"stop\":512,\"mode\":2},{\"start\":513,\"stop\":522,\"mode\":3},{\"start\":523,\"stop\":568,\"mode\":2},{\"start\":569,\"stop\":581,\"mode\":3},{\"start\":582,\"stop\":638,\"mode\":2},{\"start\":639,\"stop\":654,\"mode\":3},{\"start\":655,\"stop\":665,\"mode\":2}],\"ed\":1589943900,\"wk\":0,\"wc\":0},\"tz\":\"28800\",\"stp\":{\"runCal\":1,\"cal\":6,\"conAct\":0,\"stage\":[],\"ttl\":12345,\"dis\":144,\"rn\":0,\"wk\":5,\"runDist\":4,\"ncal\":0},\"v\":5,\"goal\":8000}","data":[{"stop":1439,"value":"WhQAUA0AUAAAUAAAUAAAUAAAUAAAWhQAUAYAcBEAUAYAUA8AUAsAUAYAUDIAUCQAUDkAUCkAUD4AUC0AUFcAUD8AUCkAUCEAUCwAUCsAUB4AUCQAUBsAUCcAUBQAUDcAUBoAUCYAUFcAUCAAUDkAUCEAWhQAWhQAWhQAUBAAUEgAUD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+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+\/v7+","summary_hr":"{\"ct\":0,\"id\":[]}","date":"


第三步:先测试下,测试模板选择api,在queryString中填入user、password、step,然后点击测试

第四步:点击触发管理,新建一个api触发器,名字随便取,点击提交后,会有访问路径


得到访问路径就ok了,在链接后面加“?”然后添加相应的参数,假如你的手机号是12345,密码是00000,要修改的步数是20000,拼接好的链接就是https://*.tencentcs.com/release/change_step_test?user=12345&password=00000&step=20000

直接访问就可以调用api了


免费评分

参与人数 13吾爱币 +14 热心值 +12 收起 理由
银狐狸 + 1 热心回复!
爱被爱时 + 1 + 1 聊表心意 请大神笑纳
ciss520 + 1 + 1 谢谢@Thanks!
闷骚小贱男 + 1 感谢,做了个PHP版本的和易语言版本的,自用。
gy55you + 1 + 1 我很赞同!
wodeweiyimpm + 1 + 1 其他失效,这个终于学会了
云音浅歌 + 1 + 1 谢谢@Thanks!
superBoyJack + 3 + 1 api源码好评
dyt0801 + 1 + 1 成功了,链接可以在微信里直接点击,都不用复制到浏览器了
小白来袭2 + 1 + 1 我很赞同!
Immortal_Y + 1 + 1 谢谢@Thanks!
ydx080 + 1 会和谐吗?????
anandyuan + 2 + 1 谢谢@Thanks!

查看全部评分

本帖被以下淘专辑推荐:

  • · 雲方|主题: 30, 订阅: 7

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

推荐
Immortal_Y 发表于 2020-10-24 21:00
START RequestId: 112333ca-f6ea-4e1e-830c-c9ef220621aa

Event RequestId: 112333ca-f6ea-4e1e-830c-c9ef220621aa

{'user': '13430330073', 'password': 'xnmi12345', 'step': '20001'}

Starting new HTTPS connection (1): api-user.huami.com:443

https://api-user.huami.com:443 "POST /registrations/+8613430330073/tokens HTTP/1.1" 303 0


access_code获取成功!

NMfjV-H3tGdwQfhPKYx6f

Starting new HTTPS connection (1): account.huami.com:443

https://account.huami.com:443 "POST /v2/client/login HTTP/1.1" 200 None

login_token获取成功!

NQVBQFJyQktGHlp6QkpbRl5LRl5qek4uXAQEBAAAAAPyVK47YDiLic4jScxb9Hzrzxw7Kpt5YnaJhRR1OhEajlI9VndwsBuyTLnplNnqyS2Il2cbtHaRJqUAk50tDAUKAa0dDBCfj773XZWckKwjRvqlRG6hG2i_1ZyZvyVZje5Fr8dSHXR_aAQPXkIsCxqFD9ytn7bNaOiuqaozGGq__nYIeDD7Adxg1kq7zeOtqxIdd8fDpVOkRLQvkHtiJtms

userid获取成功!

1096785429

Starting new HTTP connection (1): api.m.taobao.com:80

http://api.m.taobao.com:80 "GET /rest/api3.do?api=mtop.common.getTimestamp HTTP/1.1" 200 109

Starting new HTTPS connection (1): account-cn.huami.com:443

https://account-cn.huami.com:443 "GET /v1/client/app_tokens?app_name=com.xiaomi.hm.health&dn=api-user.huami.com%2Capi-mifit.huami.com%2Capp-analytics.huami.com&login_token=NQVBQFJyQktGHlp6QkpbRl5LRl5qek4uXAQEBAAAAAPyVK47YDiLic4jScxb9Hzrzxw7Kpt5YnaJhRR1OhEajlI9VndwsBuyTLnplNnqyS2Il2cbtHaRJqUAk50tDAUKAa0dDBCfj773XZWckKwjRvqlRG6hG2i_1ZyZvyVZje5Fr8dSHXR_aAQPXkIsCxqFD9ytn7bNaOiuqaozGGq__nYIeDD7Adxg1kq7zeOtqxIdd8fDpVOkRLQvkHtiJtms&os_version=4.1.0 HTTP/1.1" 200 None

app_token获取成功!

NQVBQFJyQktGHlp6QkpbRl5LRl5qek4uXAQABAAAAAN8uHSgIUrUweIiR_JYlHLApA8BOR6VfKd3GCnvIb4-5TL1QmGSZFNhxyHoPE9IzL9ckisXcTciUCakHDuGCRhLHwS-lMfKSa2HsU-jdBmoMrWOHbsvFQJKoBXqSwtIEz-KEsXtT5SckX5opg6LNmNMH4aes1OqbpEXCMACF1nCfrhlnI8HdWuBGIQq-YkNpew

Starting new HTTPS connection (1): api-mifit-cn.huami.com:443

https://api-mifit-cn.huami.com:443 "POST /v1/data/band_data.json?&t=1603544296143 HTTP/1.1" 500 113

{'code': -50000, 'message': 'Failed to process the request. Detailed error message has been logged on server side.'}

change step 20001:Failed to process the request. Detailed error message has been logged on server side.


END RequestId: 112333ca-f6ea-4e1e-830c-c9ef220621aa

Report RequestId: 112333ca-f6ea-4e1e-830c-c9ef220621aa Duration:2220ms Memory:128MB MemUsage:20.0391MB

大佬,请问这是哪里出问题了?怎么解决呢?
推荐
anjiani 发表于 2020-10-24 15:43
返回结果
Traceback (most recent call last):
  File "/var/runtime/python3/bootstrap.py", line 133, in init_handler
    func_handler = get_func_handler(file.rsplit(".", 1)[0], func)
  File "/var/runtime/python3/bootstrap.py", line 159, in get_func_handler
    mod = imp.load_module(mname, *imp.find_module(mname))
  File "/var/lang/python3/lib/python3.6/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/var/lang/python3/lib/python3.6/imp.py", line 172, in load_source
    module = _load(spec)
  File "&lt;frozen importlib._bootstrap&gt;", line 675, in _load
  File "&lt;frozen importlib._bootstrap&gt;", line 655, in _load_unlocked
  File "&lt;frozen importlib._bootstrap_external&gt;", line 674, in exec_module
  File "&lt;frozen importlib._bootstrap_external&gt;", line 781, in get_code
  File "&lt;frozen importlib._bootstrap_external&gt;", line 741, in source_to_code
  File "&lt;frozen importlib._bootstrap&gt;", line 205, in _call_with_frames_removed
  File "/var/user/index.py", line 114
    return t[url=]B[/url]
             ^
SyntaxError: invalid syntax
沙发
liangqz 发表于 2020-10-24 15:12
3#
坐久落花多 发表于 2020-10-24 15:24

看着不错,谢谢分享
4#
liphily 发表于 2020-10-24 15:39
目前我用了你帖子中的链接的那个方法,设定了每天晚上11点自动刷。
你这个更进一步,可以随时改了。
既然有了提交参数的链接,我接下来再挂个html,设置2个input,然后美滋滋
5#
anjiani 发表于 2020-10-24 15:41
为啥我测试的时候是测试失败
7#
Hikiii 发表于 2020-10-24 15:58
最近刚好在学python
8#
 楼主| feifeishishuaib 发表于 2020-10-24 17:13 |楼主
anjiani 发表于 2020-10-24 15:43
返回结果
Traceback (most recent call last):
  File "/var/runtime/python3/bootstrap.py", line 133,  ...

发帖的时候没编辑好,你再复制下
9#
zsf666 发表于 2020-10-24 17:17
感谢分享,亲测成功!
10#
anjiani 发表于 2020-10-24 17:25
feifeishishuaib 发表于 2020-10-24 17:13
发帖的时候没编辑好,你再复制下

好了,可以了,感谢
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2020-11-29 13:33

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表