def start(location=LOCATION, report_time=REPORT_TIME):
if datetime.datetime.now().strftime('%H:%M') == report_time: #?? 03:25
weather = ''
count = 0
while not weather:
weather = get_weather(location)
count += 1
print('??????%d?' % count)
time.sleep(1)
if count >= 10:
break
if not weather:
print('????????')
else:
#???????
for USER_NAME in USER_NAME_LIST:
num = itchat.search_friends(name = USER_NAME)[0]["UserName"]
try:
itchat.send_msg(get_weather(location), num)
except Exception as e:
print(e)
#print(get_weather(location))
评论列表
文章目录