Skip to content

Commit 96866c1

Browse files
authored
Fix urllib.error bad import (#120)
1 parent dd5bc43 commit 96866c1

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

datacommons/query.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ def query(query_string, select=None):
104104
try:
105105
res = six.moves.urllib.request.urlopen(req)
106106
except six.moves.urllib.error.HTTPError as e:
107-
raise ValueError(
108-
'Response error: An HTTP {} code was returned by the mixer. Printing '
109-
'response\n\n{}'.format(e.code, e.read()))
107+
raise ValueError('Response error {}:\n{}'.format(e.code, e.read()))
110108

111109
# Verify then store the results.
112110
res_json = json.loads(res.read())

datacommons/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def _send_request(req_url, req_json={}, compress=False, post=True):
106106
req = six.moves.urllib.request.Request(req_url, headers=headers)
107107
try:
108108
res = six.moves.urllib.request.urlopen(req)
109-
except urllib.error.HTTPError as e:
109+
except six.moves.urllib.error.HTTPError as e:
110110
raise ValueError(
111111
'Response error: An HTTP {} code was returned by the mixer. Printing '
112112
'response\n\n{}'.format(e.code, e.read()))

0 commit comments

Comments
 (0)