yf_yzl il y a 2 ans
Parent
commit
06163b4082
1 fichiers modifiés avec 5 ajouts et 4 suppressions
  1. 5 4
      crond_script/crond_weather.py

+ 5 - 4
crond_script/crond_weather.py

@@ -77,9 +77,10 @@ def init_data():
     
 
 def main():
-    logging.warning("up today ...")
+    logging.warning("up server day ...")
     server_days = ServerDayData.objects.all()
     for server_day_obj in server_days:
+        logging.warning(server_day_obj.cityid)
         server_day_url = f"http://v0.yiketianqi.com/api?unescape=1&version=v91&appid=69334222&appsecret=2u4bHXHD&cityid={server_day_obj.cityid}&ext=hours,aqi,life"
         server_day_response = requests.get(server_day_url, timeout=5)
         try:
@@ -88,12 +89,13 @@ def main():
                 server_day_obj.content = str(server_day_data)
                 server_day_obj.save()
         except Exception as e:
-            logging.warning(f"cityid {server_day_obj.cityid}  error {e} {today_response.text}")
+            logging.warning(f"cityid {server_day_obj.cityid}  error {e} {server_day_response.text}")
         time.sleep(random.randint(1, 5))
     logging.warning("over server day ...")
 
     day_data = DayData.objects.all()
     for day_obj in day_data:
+        logging.warning(day_obj.cityid)
         today_url = f"http://v0.yiketianqi.com/api?unescape=1&version=v62&appid=69334222&appsecret=2u4bHXHD&cityid={day_obj.cityid}"
         today_response = requests.get(today_url, timeout=5)
         try:
@@ -104,8 +106,7 @@ def main():
         except Exception as e:
             logging.warning(f"cityid {day_obj.cityid}  error {e} {today_response.text}")
         time.sleep(random.randint(1, 5))
-    logging.warning("over today ...")
-    logging.warning("up server day ...")
+
 
 
     """