yf_yzl 2 gadi atpakaļ
vecāks
revīzija
108662a30f
1 mainītis faili ar 2 papildinājumiem un 0 dzēšanām
  1. 2 0
      crond_script/crond_weather.py

+ 2 - 0
crond_script/crond_weather.py

@@ -99,6 +99,7 @@ def main():
             else:
                 logging.warning(f"cityid {day_obj.cityid}  error_code {today_response.status_code}")
                 logging.warning(f"request fail again : {day_obj.cityid}")
+                time.sleep(2)
                 today_response = requests.get(today_url, headers=headers, timeout=5)
                 if today_response.status_code == 200:
                     today_data = json.loads(today_response.text)
@@ -135,6 +136,7 @@ def main():
                     server_day_obj.content = str(server_day_data)
                     server_day_obj.save()
             else:
+                time.sleep(2)
                 logging.warning(f"cityid {day_obj.cityid}  error_code {server_day_response.status_code}")
                 logging.warning(f"request fail again : {server_day_obj.cityid}")
                 server_day_response = requests.get(server_day_url, headers=headers, timeout=5)