|
|
@@ -84,19 +84,20 @@ def main():
|
|
|
temp = row.city # 东城区
|
|
|
city_id = row.city_id # 110101000000
|
|
|
pid = row.pid # 110100000000
|
|
|
+ province_id = city_id[:2]
|
|
|
+ province = province_dict.get(province_id)
|
|
|
if len(pid) == 2:
|
|
|
- # 处理 省 市 样例
|
|
|
+ # 处理 市辖区
|
|
|
city = temp
|
|
|
district = ""
|
|
|
else:
|
|
|
- te = District.objects.filter(pid=pid).first()
|
|
|
+ te = District.objects.filter(city_id=pid).first()
|
|
|
city = te.city
|
|
|
district = temp
|
|
|
if city == "市辖区":
|
|
|
city = district
|
|
|
district = ""
|
|
|
- province_id = city_id[:2]
|
|
|
- province = province_dict.get(province_id)
|
|
|
+
|
|
|
try:
|
|
|
today_url = f"https://v0.yiketianqi.com/api?unescape=1&version=v62&appid={app_id}&appsecret={app_secret}&adcode={city_id}"
|
|
|
today_response = requests.get(today_url, timeout=5)
|