Skip to content

Commit

Permalink
Fix potential __enter__ attribute issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremydvoss committed Jan 9, 2024
1 parent 74ac799 commit 4bfc0fe
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def get_azure_vm_metadata(self): # pylint: disable=no-self-use
request = Request(_AZURE_VM_METADATA_ENDPOINT)
request.add_header("Metadata", "True")
try:
with urlopen(request, timeout=10).read() as response:
return loads(response)
with urlopen(request, timeout=10) as response:
return loads(response.read())
except URLError:
# Not on Azure VM
return None
Expand Down

0 comments on commit 4bfc0fe

Please sign in to comment.