From 7a7063a79e2406967022ea42a1e32c0711522f55 Mon Sep 17 00:00:00 2001 From: KingRan Date: Wed, 16 Feb 2022 21:32:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_health_plant.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jd_health_plant.py b/jd_health_plant.py index 7b3b2a5..f64e941 100644 --- a/jd_health_plant.py +++ b/jd_health_plant.py @@ -532,10 +532,10 @@ def charge(charge_targe_id,cookies,sid,account): for i in range(10): response = requests.post(url=url, verify=False, headers=headers,data=data.encode()) #data中有汉字,需要encode为utf-8 result = response.json() - # print(result) + print(result) user_coins = result['user_coins'] #剩余能量 coins = result['plant_info']['coins'] #消耗能量 - msg ("充能成功,消耗【{1}】能量,剩余能量【{2}】".format (coins,user_coins)) + msg ("充能成功,消耗【{0}】能量,剩余能量【{1}】".format (coins,user_coins)) time.sleep(2) except Exception as e: @@ -590,9 +590,10 @@ def start(): taskName, taskId, taskToken_list = get_task2 (cookie,sid, account) for i in taskToken_list: do_task2 (cookie, taskName, taskId, i, sid,account) - charge (charge_targe_id, cookie,sid, account) + except Exception as e: pass + charge (charge_targe_id, cookie, sid, account) else: printT("请检查变量plant_cookie是否已填写")