Skip to content

Instantly share code, notes, and snippets.

@HassenIO
Created May 11, 2021 17:33
Show Gist options
  • Save HassenIO/55981812f8101a77f52498f231adc788 to your computer and use it in GitHub Desktop.
Save HassenIO/55981812f8101a77f52498f231adc788 to your computer and use it in GitHub Desktop.
Understanding PIP [blog article]
from urllib.request import urlopen, Request
url = "https://swapi.dev/api/people/42/"
httprequest = Request(url, headers={"Accept": "application/json"})
with urlopen(httprequest) as response:
print(response.status)
print(response.read().decode())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment