rcgsheffield / urban_flows

Research Computing work for the Urban Flows project
2 stars 2 forks source link

DEFRA SOS get stations client error #5

Closed Joe-Heffer-Shef closed 4 years ago

Joe-Heffer-Shef commented 4 years ago

I'm on master 39032ef

When I run > python pipeline.py -d 2020-01-01 -od test.csv I get the output below.

ERROR:http_session:400 Client Error: Bad Request for url: https://uk-air.defra.gov.uk/sos-ukair/api/v1/stations?near=%7B'near':%20'%7B%22center%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B53.379699%2C-1.469815%5D%7D%2C%22radius%22%3A50%7D'%7D ERROR:http_session:<html><head><title>Apache Tomcat/7.0.82 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 400 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The request sent by the client was syntactically incorrect.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.82</h3></body></html> Traceback (most recent call last): File "pipeline.py", line 54, in <module> main() File "pipeline.py", line 32, in main stations = list(fh.get_stations()) File "C:\Users\joesh\Documents\University of Sheffield\Urban Flows Observatory\Data Pipelines\urban_flows\defra_sos\download.py", line 54, in get_stations data = self.session.call(self.base_url, 'stations?near={}'.format(query)) File "C:\Users\joesh\Documents\University of Sheffield\Urban Flows Observatory\Data Pipelines\urban_flows\defra_sos\http_session.py", line 37, in call response = self._call(base_url, endpoint, **kwargs) File "C:\Users\joesh\Documents\University of Sheffield\Urban Flows Observatory\Data Pipelines\urban_flows\defra_sos\http_session.py", line 26, in _call response.raise_for_status() File "C:\Users\joesh\Miniconda3\envs\uflo\lib\site-packages\requests\models.py", line 939, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://uk-air.defra.gov.uk/sos-ukair/api/v1/stations?near=%7B'near':%20'%7B%22center%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B53.379699%2C-1.469815%5D%7D%2C%22radius%22%3A50%7D'%7D