Skip to content

Commit

Permalink
Returning response value in compute_engine_id() instead of using var.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Jan 29, 2015
1 parent 8dc13b5 commit 8febd04
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions gcloud/datastore/_implicit_environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,12 @@ def compute_engine_id():
headers = {'Metadata-Flavor': 'Google'}
connection = httplib.HTTPConnection(host, timeout=0.1)

content = None
try:
connection.request('GET', uri_path, headers=headers)
response = connection.getresponse()
if response.status == 200:
content = response.read()
return response.read()
except socket.error: # socket.timeout or socket.error(64, 'Host is down')
pass
finally:
connection.close()

return content

0 comments on commit 8febd04

Please sign in to comment.