diff --git a/op5_query_to_csv.py b/op5_query_to_csv.py index b22847f..7920462 100644 --- a/op5_query_to_csv.py +++ b/op5_query_to_csv.py @@ -79,6 +79,10 @@ # Process the response of the GET request. res = conn.getresponse() +if res.status >= 400: + print('Server returned status code {status} - {reason}'.format(status=res.status, reason=res.reason)) + exit(1) + # Create JSON from the results. json_results = json.loads(res.read())