抓包之后用python request提交
但是只能最高修改一万步,这是为什么?
[Python] 纯文本查看 复制代码 import requests
import time
import urllib3
import json
def change_Steps(steps):
url = 'https://sports.lifesense.com/sport_service/sport/sport/uploadMobileStepV2?country=%E4%B8%AD%E5%9B%BD&city=%E9%95%BF%E6%B2%99&cityCode=430100&timezone=Asia%2FShanghai&latitude=27.969713&os_country=CN&channel=huawei&language=zh&openudid=&platform=android&province=%E6%B9%96%E5%8D%97%E7%9C%81&appType=6&requestId=1cda94c5f7b7468c9419beb024b558cf&countryCode=&systemType=2&longitude=112.046989&devicemodel=HRY-AL00Ta&area=CN&screenwidth=1080&os_langs=zh&provinceCode=430000&promotion_channel=huawei&rnd=878f5f5e&version=4.6.2&areaCode=430182&requestToken=32b8a19b6cc9c5c9ba4e31aefbb00359&network_type=wifi&osversion=10&screenheight=2259'
bodyData = {
"list": [
{"active": 1,
"calories": 0,
"created": time.strftime("%Y-%m-%d %H:%M:%S"),
"dataSource": 2,
"dayMeasurementTime": time.strftime("%Y-%m-%d"),
"deviceId": "M_NULL",
"distance": steps // 3,
"id": "0536c843f14641e6a7221d6d8ed58fe8",
"isUpload": 1,
"measurementTime": time.strftime("%Y-%m-%d %H:%M:%S"),
"priority": 0,
"step": steps,
"type": 2,
"updated": int(round(int(time.time()) * 1000)),
"userId": "26799845",
"DataSource": 3,
"exerciseTime": 0
}
]
}
bodyData = json.dumps(bodyData)
headers = {
'Cookie': 'session=%7B%22accessToken%22%3A%225ff6daa624c74542abe9c4576b6120c5%22%2C%22appType%22%3A6%2C%22expireAt%22%3A1598090617906%2C%22loginId%22%3A%2226799845%22%2C%22userType%22%3A99%2C%22gray%22%3Afalse%7D; appType2=6; accessToken2=5ff6daa624c74542abe9c4576b6120c5; expireAt2=1598090617906; loginId2=26799845; userType2=99; gray2=false; session=%7B%22accessToken%22%3A%225ff6daa624c74542abe9c4576b6120c5%22%2C%22appType%22%3A6%2C%22expireAt%22%3A1598090617906%2C%22loginId%22%3A%2226799845%22%2C%22userType%22%3A99%2C%22gray%22%3Afalse%7D; userType2=99; expireAt2=1598090617906; accessToken=D2A6AFB93531605DBE56DC2EEE74C4C9A2A9D448D7091FD682B71C94EA82651DACF21FA1EE36EF7A3C242B9712DA0194A460995D3611B4A14377E3900DF9806005FF025EE32D40925CDD613E04A72BA53A1CEA85B62B1E5876B669542B221078.FC800F8B2F9A81A037BB247BA981EB947D2D665249B3B78646975B1A1A48AF2B; accessToken2=5ff6daa624c74542abe9c4576b6120c5; loginId2=26799845; gray2=false; appType2=6',
"Content-Type": "application/json; charset=utf-8",
"User-Agent": "Dalvik/2.1.0 (Linux; U; Android 10; HRY-AL00Ta Build/HONORHRY-AL00Ta)",
"Host": "sports.lifesense.com",
"Connection": "Keep-Alive",
"Accept-Encoding": "gzip",
"Content-Length": "390"
}
urllib3.disable_warnings()
response = requests.post(url, data=bodyData, headers=headers, verify=False)
data = json.loads(response.text)
print(data["code"], end=' ')
print(data["msg"], end=' ')
print(len(data["data"]["pedometerRecordHourlyList"]), end=' ')
print(data["data"]["pedometerRecordHourlyList"][0]['step'].split(','))
# print(int(data["data"]["pedometerRecordHourlyList"][0]["step"].split(',')[17]))
if __name__ == '__main__':
change_Steps(29000)
|