Skip to content

Commit

Permalink
Added http error handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Dobbins committed May 24, 2021
1 parent bea16dc commit 2f15bda
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions op5_query_to_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down

0 comments on commit 2f15bda

Please sign in to comment.