python修改微信和支付寶步數

2021-10-24 16:48:30 字數 3253 閱讀 3252

第二步:註冊賬號登入,並設定登入密碼。

第四步:執行python指令碼,修改樂心健康步數。

程式設定是每天7點自動修改步數,在下面指令碼對應的位置替換填入樂心健康賬號、樂心健康密碼、修改步數,然後執行程式。修改步數推薦設定範圍是30000至90000,步數值太大會導致修改不成功。如果想改變第二天自動修改步數的時間,請修改圖示位置的25200,+25200代表第二天0點後加上的秒數,也就是7x60x60,即7小時,根據自己的需要修改即可。如果每天都要修改步數,那麼讓程式一直保持執行即可。

注意:執行程式會立刻修改當天的步數,自動修改步數是從程式保持執行的第二天開始。

# 登入

def login(self):

url = ''

data =

response_result = requests.post(url, data=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:

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 = ''

data = ]}

headers =

response_result = requests.post(url, data=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 '修改步數失敗'

# 睡眠到第二天執行修改步數的時間

def get_sleep_time():

# 第二天日期

tomorrow = datetime.date.today() + datetime.timedelta(days=1)

# 第二天7點時間戳

tomorrow_run_time = int(time.mktime(time.strptime(str(tomorrow), '%y-%m-%d'))) + 25200

# print(tomorrow_run_time)

# 當前時間戳

current_time = int(time.time())

# print(current_time)

return tomorrow_run_time - current_time

if __name__ == "__main__":

# 最大執行出錯次數

fail_num = 3

while 1:

while fail_num > 0:

try:

# 修改步數結果

result = lexinsport('樂心健康賬號', '樂心健康密碼', 修改步數).change_step()

print(result)

break

except exception as e:

print('執行出錯,原因:%s' % e)

fail_num -= 1

if fail_num == 0:

print('修改步數失敗')

# 重置執行出錯次數

fail_num = 3

# 獲取睡眠時間

sleep_time = get_sleep_time()

time.sleep(sleep_time)

微信支付和支付寶支付

一 先copy下寫給後台的文件 支付寶 互動流程詳見 客戶端 android 呼叫的快捷支付介面如下 該介面需要傳入兩個引數 第二個引數 isshowpayloading 是ui方面的設定,與後台無關。第乙個引數 orderinfo 需要 後台伺服器給出 客戶端發起支付請求需要之前 需要 商戶伺服器...

微信支付寶支付

備忘,如果有看到的小夥伴,希望能幫助到你 測試的時候一定要用自定義基座測試 證書檔案是你的.keystore檔案路徑,在生成證書的時候一點更要記住檔案位置和密碼!實在忘記了,就最簡單粗暴的方法,重新生成把,但是在重新生成時,一定要記得把相關用到證書資訊的地方全部修改一遍。cmd開啟 生成.keyst...

微信支付 支付寶支付

二 移動端支付寶支付 weixinpay data else if document.attachevent else onbridgeready function res vm.number null vm.router.go 1 vm.base url index.html depositres...