Created
May 3, 2012 17:40
-
-
Save maksbotan/2587517 to your computer and use it in GitHub Desktop.
Minimal test case for github auth api
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 json, urllib2 | |
>>> data = {"scopes": ["gist"], "note": "pgist client"} | |
>>> j_req = json.dumps(data) | |
>>> req = urllib2.Request("https://api.github.com", data=j_req) | |
>>> resp = urllib2.urlopen(req) | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
File "/usr/lib64/python2.7/urllib2.py", line 126, in urlopen | |
return _opener.open(url, data, timeout) | |
File "/usr/lib64/python2.7/urllib2.py", line 406, in open | |
response = meth(req, response) | |
File "/usr/lib64/python2.7/urllib2.py", line 519, in http_response | |
'http', request, response, code, msg, hdrs) | |
File "/usr/lib64/python2.7/urllib2.py", line 444, in error | |
return self._call_chain(*args) | |
File "/usr/lib64/python2.7/urllib2.py", line 378, in _call_chain | |
result = func(*args) | |
File "/usr/lib64/python2.7/urllib2.py", line 527, in http_error_default | |
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) | |
urllib2.HTTPError: HTTP Error 404: Not Found |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment