Skip to content

Commit aab10be

Browse files
committed
20190402
1 parent 2c95061 commit aab10be

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

WeatherMonitor/weather_getter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def save_aqi(city_name, site_name, aqi, main, pm10, pm25, no2, so2, co, o3):
5858
city_code = City.select().where(City.city_name == city_name).get()
5959
city_code = city_code.id
6060
try:
61-
crawling_times = int(len(AQI.select().where((AQI.date == datetime.datetime.now().date()) & (AQI.site_name == site_name))))
61+
crawling_times = AQI.select().where((AQI.date == datetime.datetime.now().date()) & (AQI.site_name == site_name)).count()
6262
except Exception:
6363
crawling_times = 0
6464
p = AQI(
@@ -80,7 +80,7 @@ def save_aqi(city_name, site_name, aqi, main, pm10, pm25, no2, so2, co, o3):
8080
key = get_key()
8181

8282

83-
crawling_times = int(len(Weather.select().where((Weather.date == datetime.datetime.now().date()) & (Weather.city_code == '长春'))))
83+
crawling_times = Weather.select().where((Weather.date == datetime.datetime.now().date()) & (Weather.city_code == '长春')).count()
8484
if crawling_times ==0:
8585
today_tmp_max, today_tmp_min = get_temp(key, 'changchun')
8686
save_temp('长春', today_tmp_max, today_tmp_min)

database.db

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)