Created
February 6, 2015 05:16
-
-
Save nicolasmendoza/f0cc678137dcb2064b9b to your computer and use it in GitHub Desktop.
request with urlib2
This file contains hidden or 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 urllib2 | |
from base64 import b64encode | |
request = urllib2.Request('https://api.xxxx.com/user') | |
request.add_header('Authorization', 'Basic ' + b64encode('user' + ':' + 'pass')) | |
r = urllib2.urlopen(request) | |
print r.getcode() | |
print r.headers["content-type"] | |
print r.headers["X-RateLimit-Limit"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment