Skip to content
This repository was archived by the owner on Oct 31, 2022. It is now read-only.

Commit 1e4a9e2

Browse files
committed
修复#13错误
库存监控check_stock方法中json文件转换报错 #13
1 parent 090503e commit 1e4a9e2

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

check_stock.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def check_stock():
104104
extract_categories()
105105
flag = False
106106
msg = ""
107-
with open("all_categories_formatted.json") as f:
107+
with open("all_categories_formatted.json", encoding='utf-8') as f:
108108
flag = False
109109
all_categories = json.load(f)
110110

main.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ def check_home():
1919
res = r.json()
2020
if res['code'] == 0:
2121
find = r.text.find(config.key_word)
22-
params = {'group': '叮咚买菜'}
2322
print(r.text)
2423
if find > 0:
2524
print('还没有运力!', time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
2625
else:
2726
txt = '叮咚买菜有运力啦!!!'
2827
send_msg_bark(txt)
28+
else:
29+
print('请求异常', r.text)
2930

3031

3132
# 检查购物车 需要cookie
@@ -59,7 +60,6 @@ def check_cart():
5960
print(res)
6061
if res['code'] == 0:
6162
reserve_times = res['data'][0]['time'][0]['times']
62-
params = {'group': '叮咚买菜'}
6363
all_full = True
6464
for reserve_time in reserve_times:
6565
all_full = all_full and reserve_time['fullFlag']
@@ -70,6 +70,8 @@ def check_cart():
7070
print('还没有可预约时间!')
7171
else:
7272
print('请求异常!')
73+
else:
74+
print('请求异常', r.text)
7375

7476

7577
def run():

0 commit comments

Comments
 (0)