[Django]-Github issues api 401, why? (django)

2👍

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}
)

0👍

I don’t know if it is exactly what you need, but this is the code I use in one of my project to open issues:

def issue(self, channel, network, nick, user, title, repoName):
    body = 'Issue sent from %s at %s by %s (registered as %s)' % \
            (channel, network, nick, user.name)
    login = self.registryValue('login')
    token = self.registryValue('token')
    data='title=%s&body=%s&login=%s&token=%s' % (title, body, login, token)
    url = 'http://github.com/api/v2/json/issues/open/' + repoName
    response = json.loads(urllib.urlopen(url, data=data).read())
    id = response['issue']['number']
    return id

Leave a comment