Skip to content

Instantly share code, notes, and snippets.

@maksbotan
Created May 3, 2012 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maksbotan/2587517 to your computer and use it in GitHub Desktop.
Save maksbotan/2587517 to your computer and use it in GitHub Desktop.
Minimal test case for github auth api
>>> 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