Procházet zdrojové kódy

更新天气接口超时时间

林轩 před 1 rokem
rodič
revize
4728e910e8
2 změnil soubory, kde provedl 3 přidání a 3 odebrání
  1. 1 1
      crond_script/server_weather.py
  2. 2 2
      crond_script/today_weather.py

+ 1 - 1
crond_script/server_weather.py

@@ -93,7 +93,7 @@ def main():
         time_out_k = False 
         logging.warning(server_day_obj.cityid)
         server_day_url = f"http://v0.yiketianqi.com/api?unescape=1&version=v91&appid=69334222&appsecret=2ME6U58N&cityid={server_day_obj.cityid}&ext=hours,aqi,life"
-        server_day_response = requests.get(server_day_url, headers=headers, timeout=5)
+        server_day_response = requests.get(server_day_url, headers=headers, timeout=10)
         server_ct += 1
         try:
             if server_day_response.status_code == 200:

+ 2 - 2
crond_script/today_weather.py

@@ -92,8 +92,8 @@ def main():
     for day_obj in day_data:
         time_out = False 
         logging.warning(day_obj.cityid)
-        today_url = f"http://v0.yiketianqi.com/api?unescape=1&version=v62&appid=69334222&appsecret=2ME6U58N&cityid={day_obj.cityid}"
-        today_response = requests.get(today_url, headers=headers, timeout=5)
+        today_url = f"http://v1.yiketianqi.com/api?unescape=1&version=v62&appid=69334222&appsecret=2ME6U58N&cityid={day_obj.cityid}"
+        today_response = requests.get(today_url, headers=headers, timeout=10)
         day_ct += 1
         try:
             if today_response.status_code == 200: