response_text = response_result.text
# print('登录状态码:%s' % status_code)
# print('登录返回数据:%s' % response_text)
if status_code == 200:
response_text = json.loads(response_text)
user_id = response_text['data']['userId']
access_token = response_text['data']['accessToken']
return user_id, access_token
else:
return '登录失败'
# 修改步数
def change_step(self):
# 登录结果
login_result = self.login()
if login_result == '登录失败':
return '登录失败'
else:
url = 'https://sports.lifesense.com/sport_service/sport/sport/uploadMobileStepV2?systemType=2&version=4.6.7'
data = https://www.bjxdyg.com/life/{'list': [{'DataSource': 2, 'active': 1, 'calories': int(self.step/4), 'dataSource': 2,
'deviceId': 'M_NULL', 'distance': int(self.step/3), 'exerciseTime': 0, 'isUpload': 0,
'measurementTime': time.strftime('%Y-%m-%d %H:%M:%S'), 'priority': 0, 'step': self.step,
'type': 2, 'updated': int(round(time.time() * 1000)), 'userId': login_result[0]}]}
headers = {
'Content-Type': 'application/json; charset=utf-8',
'Cookie': 'accessToken=%s' % login_result[1]
}
response_result = requests.post(url, data=https://www.bjxdyg.com/life/json.dumps(data), headers=headers)
status_code = response_result.status_code
# response_text = response_result.text
# print('修改步数状态码:%s' % status_code)
# print('修改步数返回数据:%s' % response_text)
if status_code == 200:
return '修改步数为【%s】成功' % self.step
else:
return '修改步数失败'
微信步数实现效果如下:
支付宝运动实现效果如下:
更多系列文章
敬请期待
我是CoCo,计算机科学与技术专业,深漂大厂互联网民工(女),坐标深圳 。5年工作经验,3年持续输出技术文 。ITester软件测试小栈(ID:ITestingA)号主,专注于软件测试技术和宝藏干货分享,每周准时更新原创技术文章,每月不定期赠送技术书籍,愿我们在更高处相逢 。喜欢记得星标?我,及时获得最新文章推送,第三方转载请注明出处 。
想获取更多最新干货内容
快来星标 置顶 关注我
每周一、三、五 08:30见
推荐阅读
- vue能改时长吗? vue修改时间格式
- excel怎样设置修改密码
- 公众号名称怎么修改,公众号名称怎么修改不了
- 衡阳2022年专项附加扣除信息修改指引
- Excel表格如何设置内容只能输入不能修改
- 水印时间如何修改 拍好的水印怎么换时间和地点
- 如何更改证件照的背景色 如何修改证件照片背景底色
- 农行卡预留手机号怎么修改不了 农行卡预留手机号怎么修改
- 怎么把图片颜色加深 如何修改图片背景颜色
- 臂环纹身可以遮盖修改吗? 臂环纹身可以遮盖修改吗