I'm trying to integrate github issues api into a project. I think I'm following the rules of oauth, and everything that is needed and mentioned on http://develop.github.com/p/issues.html, but it doesn't seem to work. I don't get detailed error message, just a 401.
actual implementatios with django, python:
url = 'https://github.com/login/oauth/access_token?client_id=%(client_id)s&redirect_uri=%(redirect_uri)s&client_secret=%(client_secret)s&code=%(code)s' % locals()
req = urllib2.Request(url)
response = urllib2.urlopen(req).read()
access_token = re.search(r'access_token=(\w+)', response).group(1)
url = 'http://github.com/api/v2/json/issues/open/%(user)s/%(repo)s' % locals()
params = urllib.urlencode({'login': user, 'token': access_token, 'title': 'title', 'body': 'body'})
req = urllib2.Request(url, params)
try:
response = urllib2.urlopen(req)
except HTTPError, e:
return HttpResponse('[*] Its a fckin %d' % e.code)
except URLError, e:
return HttpResponse('[*] %s\n' % repr(e.reason))
else:
resp = json.loads(response.read())
Could the problem be..
params = urllib.urlencode(
{'login': user, 'token': access_token, 'title': 'title', 'body': 'body'}
)
You specify that the title param has the literal value of 'title', same with 'body'.
Do you possibly want this instead? ..
params = urllib.urlencode(
{'login': user, 'token': access_token, 'title': title, 'body': body}
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With