Update data_source.py

This commit is contained in:
HibiKier 2021-08-11 11:44:39 +08:00 committed by GitHub
parent 218147b771
commit 109b80b6ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,17 +25,17 @@ async def get_yiqing_data(area: str):
if area == '中国':
province = area
province_type = ""
elif area[-1] == '' and area not in data.keys():
elif area in data.keys() and area[-1] != '':
province = area if area[-1] != '' else area[:-1]
if len(data[province]) == 1:
province_type = ""
city = ""
else:
area = area[:-1] if area[-1] == '' else area
for p in data.keys():
if area in data[p]:
province = p
city = area
elif area in data.keys():
province = area if area[-1] != '' else area[:-1]
if len(data[province]) == 1:
province_type = ""
city = ""
if not province and not city:
return "小真寻只支持国内的疫情查询喔..."
async with aiohttp.ClientSession(headers=get_user_agent()) as session: