Closed auvipy closed 9 years ago
comment out some part helped. how to get city data?
See
DEBUG:requests.packages.urllib3.connectionpool:"GET /data/2.5/history/station?appid=6e66bd9f26ca14ef553d1d8607f3775e&end=1391039999&id=5530&start=1388534400&type=hour HTTP/1.1" 500 None
OpenWeatherMap API was failing.
It was returning an HTTP status code = 500 (instead of 200) https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
So the problem was not on my side.
python owm_api.py INFO:root:Installing cache 'cache-openweathermap' with expire_after=300 (seconds) DEBUG:requests.packages.urllib3.util.retry:Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None) DEBUG:requests.packages.urllib3.util.retry:Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None) DEBUG:root:Request to 'http://api.openweathermap.org/data/2.5/weather' with '{'lon': 0.34189, 'appid': '6e66bd9f26ca14ef553d1d8607f3775e', 'lat': 46.5798114}' using 'http://api.openweathermap.org/data/2.5/weather?lon=0.34189&appid=6e66bd9f26ca14ef553d1d8607f3775e&lat=46.5798114' INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): api.openweathermap.org DEBUG:requests.packages.urllib3.connectionpool:"GET /data/2.5/weather?appid=6e66bd9f26ca14ef553d1d8607f3775e&lat=46.5798114&lon=0.34189 HTTP/1.1" 200 None {'cod': 200, 'weather': [{'icon': '04d', 'id': 803, 'description': 'broken clouds', 'main': 'Clouds'}], 'sys': {'sunrise': Timestamp('2015-05-07 04:34:35'), 'sunset': Timestamp('2015-05-07 19:15:45'), 'message': 0.0467, 'country': 'FR'}, 'id': 2986494, 'name': 'Arrondissement de Poitiers', 'clouds': {'all': 64}, 'coord': {'lon': 0.34, 'lat': 46.58}, 'base': 'stations', 'dt': Timestamp('2015-05-07 09:09:14'), 'wind': {'deg': 146.002, 'speed': 2.01}, 'main': {'sea_level': 1034.18, 'grnd_level': 1021.41, 'temp_min': 13.89100000000002, 'temp_max': 13.89100000000002, 'temp': 13.89100000000002, 'pressure': 1021.41, 'humidity': 81}} DEBUG:root:Request to 'http://api.openweathermap.org/data/2.5/station/find' with '{'cnt': 10, 'lon': 0.34189, 'appid': '6e66bd9f26ca14ef553d1d8607f3775e', 'lat': 46.5798114}' using 'http://api.openweathermap.org/data/2.5/station/find?cnt=10&lon=0.34189&appid=6e66bd9f26ca14ef553d1d8607f3775e&lat=46.5798114' DEBUG:requests.packages.urllib3.connectionpool:"GET /data/2.5/station/find?appid=6e66bd9f26ca14ef553d1d8607f3775e&cnt=10&lat=46.5798114&lon=0.34189 HTTP/1.1" 200 None INFO:root:1: from 2014-01-01 00:00:00 to 2014-01-30 00:00:00 DEBUG:root:Request to 'http://api.openweathermap.org/data/2.5/history/station' with '{'start': 1388534400, 'type': 'hour', 'appid': '6e66bd9f26ca14ef553d1d8607f3775e', 'id': 5530, 'end': 1391039999}' using 'http://api.openweathermap.org/data/2.5/history/station?start=1388534400&type=hour&appid=6e66bd9f26ca14ef553d1d8607f3775e&id=5530&end=1391039999' DEBUG:requests.packages.urllib3.connectionpool:"GET /data/2.5/history/station?appid=6e66bd9f26ca14ef553d1d8607f3775e&end=1391039999&id=5530&start=1388534400&type=hour HTTP/1.1" 500 None DEBUG:root:500 /proxy/data/2.5/history/station?end=1391039999&type=hour&id=5530&start=1388534400&
ERROR:root:Traceback (most recent call last): File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 128, in json_loads data = json.loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/init.py", line 318, in loads return _default_decoder.decode(s) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/decoder.py", line 346, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 3 column 1 (char 4 - 87)
ERROR:root:Traceback (most recent call last): File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 197, in get_historic_weather data = self._get_historic_weather(station_id, start_date, end_date) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 223, in _get_historic_weather data = json_loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 128, in json_loads data = json.loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/init.py", line 318, in loads return _default_decoder.decode(s) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/decoder.py", line 346, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 3 column 1 (char 4 - 87)
INFO:root:2: from 2014-01-31 00:00:00 to 2014-03-01 00:00:00 DEBUG:root:Request to 'http://api.openweathermap.org/data/2.5/history/station' with '{'start': 1391126400, 'type': 'hour', 'appid': '6e66bd9f26ca14ef553d1d8607f3775e', 'id': 5530, 'end': 1393631999}' using 'http://api.openweathermap.org/data/2.5/history/station?start=1391126400&type=hour&appid=6e66bd9f26ca14ef553d1d8607f3775e&id=5530&end=1393631999' DEBUG:requests.packages.urllib3.connectionpool:"GET /data/2.5/history/station?appid=6e66bd9f26ca14ef553d1d8607f3775e&end=1393631999&id=5530&start=1391126400&type=hour HTTP/1.1" 500 None DEBUG:root:500 /proxy/data/2.5/history/station?end=1393631999&type=hour&id=5530&start=1391126400&
ERROR:root:Traceback (most recent call last): File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 128, in json_loads data = json.loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/init.py", line 318, in loads return _default_decoder.decode(s) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/decoder.py", line 346, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 3 column 1 (char 4 - 87)
ERROR:root:Traceback (most recent call last): File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 197, in get_historic_weather data = self._get_historic_weather(station_id, start_date, end_date) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 223, in _get_historic_weather data = json_loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 128, in json_loads data = json.loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/init.py", line 318, in loads return _default_decoder.decode(s) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/decoder.py", line 346, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 3 column 1 (char 4 - 87)
INFO:root:3: from 2014-03-02 00:00:00 to 2014-03-31 00:00:00 DEBUG:root:Request to 'http://api.openweathermap.org/data/2.5/history/station' with '{'start': 1393718400, 'type': 'hour', 'appid': '6e66bd9f26ca14ef553d1d8607f3775e', 'id': 5530, 'end': 1396223999}' using 'http://api.openweathermap.org/data/2.5/history/station?start=1393718400&type=hour&appid=6e66bd9f26ca14ef553d1d8607f3775e&id=5530&end=1396223999' DEBUG:requests.packages.urllib3.connectionpool:"GET /data/2.5/history/station?appid=6e66bd9f26ca14ef553d1d8607f3775e&end=1396223999&id=5530&start=1393718400&type=hour HTTP/1.1" 500 None DEBUG:root:500 /proxy/data/2.5/history/station?end=1396223999&type=hour&id=5530&start=1393718400&
ERROR:root:Traceback (most recent call last): File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 128, in json_loads data = json.loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/init.py", line 318, in loads return _default_decoder.decode(s) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/decoder.py", line 346, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 3 column 1 (char 4 - 87)
ERROR:root:Traceback (most recent call last): File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 197, in get_historic_weather data = self._get_historic_weather(station_id, start_date, end_date) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 223, in _get_historic_weather data = json_loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 128, in json_loads data = json.loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/init.py", line 318, in loads return _default_decoder.decode(s) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/decoder.py", line 346, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 3 column 1 (char 4 - 87)
INFO:root:4: from 2014-04-01 00:00:00 to 2014-04-30 00:00:00 DEBUG:root:Request to 'http://api.openweathermap.org/data/2.5/history/station' with '{'start': 1396310400, 'type': 'hour', 'appid': '6e66bd9f26ca14ef553d1d8607f3775e', 'id': 5530, 'end': 1398815999}' using 'http://api.openweathermap.org/data/2.5/history/station?start=1396310400&type=hour&appid=6e66bd9f26ca14ef553d1d8607f3775e&id=5530&end=1398815999' DEBUG:requests.packages.urllib3.connectionpool:"GET /data/2.5/history/station?appid=6e66bd9f26ca14ef553d1d8607f3775e&end=1398815999&id=5530&start=1396310400&type=hour HTTP/1.1" 500 None DEBUG:root:500 /proxy/data/2.5/history/station?end=1398815999&type=hour&id=5530&start=1396310400&
ERROR:root:Traceback (most recent call last): File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 128, in json_loads data = json.loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/init.py", line 318, in loads return _default_decoder.decode(s) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/decoder.py", line 346, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 3 column 1 (char 4 - 87)
ERROR:root:Traceback (most recent call last): File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 197, in get_historic_weather data = self._get_historic_weather(station_id, start_date, end_date) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 223, in _get_historic_weather data = json_loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 128, in json_loads data = json.loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/init.py", line 318, in loads return _default_decoder.decode(s) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/decoder.py", line 346, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 3 column 1 (char 4 - 87)
INFO:root:5: from 2014-05-01 00:00:00 to 2014-05-30 00:00:00 DEBUG:root:Request to 'http://api.openweathermap.org/data/2.5/history/station' with '{'start': 1398902400, 'type': 'hour', 'appid': '6e66bd9f26ca14ef553d1d8607f3775e', 'id': 5530, 'end': 1401407999}' using 'http://api.openweathermap.org/data/2.5/history/station?start=1398902400&type=hour&appid=6e66bd9f26ca14ef553d1d8607f3775e&id=5530&end=1401407999' DEBUG:requests.packages.urllib3.connectionpool:"GET /data/2.5/history/station?appid=6e66bd9f26ca14ef553d1d8607f3775e&end=1401407999&id=5530&start=1398902400&type=hour HTTP/1.1" 500 None DEBUG:root:500 /proxy/data/2.5/history/station?end=1401407999&type=hour&id=5530&start=1398902400&
ERROR:root:Traceback (most recent call last): File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 128, in json_loads data = json.loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/init.py", line 318, in loads return _default_decoder.decode(s) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/decoder.py", line 346, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 3 column 1 (char 4 - 87)
ERROR:root:Traceback (most recent call last): File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 197, in get_historic_weather data = self._get_historic_weather(station_id, start_date, end_date) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 223, in _get_historic_weather data = json_loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 128, in json_loads data = json.loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/init.py", line 318, in loads return _default_decoder.decode(s) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/decoder.py", line 346, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 3 column 1 (char 4 - 87)
INFO:root:6: from 2014-05-31 00:00:00 to 2014-06-01 00:00:00 DEBUG:root:Request to 'http://api.openweathermap.org/data/2.5/history/station' with '{'start': 1401494400, 'type': 'hour', 'appid': '6e66bd9f26ca14ef553d1d8607f3775e', 'id': 5530, 'end': 1401580799}' using 'http://api.openweathermap.org/data/2.5/history/station?start=1401494400&type=hour&appid=6e66bd9f26ca14ef553d1d8607f3775e&id=5530&end=1401580799' DEBUG:requests.packages.urllib3.connectionpool:"GET /data/2.5/history/station?appid=6e66bd9f26ca14ef553d1d8607f3775e&end=1401580799&id=5530&start=1401494400&type=hour HTTP/1.1" 500 None DEBUG:root:500 /proxy/data/2.5/history/station?end=1401580799&type=hour&id=5530&start=1401494400&
ERROR:root:Traceback (most recent call last): File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 128, in json_loads data = json.loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/init.py", line 318, in loads return _default_decoder.decode(s) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/decoder.py", line 346, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 3 column 1 (char 4 - 87)
ERROR:root:Traceback (most recent call last): File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 197, in get_historic_weather data = self._get_historic_weather(station_id, start_date, end_date) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 223, in _get_historic_weather data = json_loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 128, in json_loads data = json.loads(data) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/init.py", line 318, in loads return _default_decoder.decode(s) File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/json/decoder.py", line 346, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 3 column 1 (char 4 - 87)
INFO:root:Build concatenated DataFrame Traceback (most recent call last): File "owm_api.py", line 24, in
data = ow.get_historic_weather(station_id, start_date, end_date) # get historic weather from start date to end date
File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/openweathermap_requests/init.py", line 204, in get_historic_weather
df_all = pd.concat(lst)
File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/pandas/tools/merge.py", line 754, in concat
copy=copy)
File "/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/pandas/tools/merge.py", line 799, in init
raise ValueError('All objects passed were None')
ValueError: All objects passed were None