Last active
August 23, 2016 14:11
-
-
Save mosampaio/0c117c571c7351a3fbfa6be88d806ef9 to your computer and use it in GitHub Desktop.
How to consume a json Rest API with Python using http.client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http.client | |
conn = http.client.HTTPSConnection("api.github.com") | |
conn.request(method="GET", url="/repos/twilio/twilio-python/contributors", | |
headers={'user-agent': 'My App'}) | |
r1 = conn.getresponse() | |
data1 = r1.read() | |
print(data1) | |
conn.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment