G J
G J

Reputation: 33

cannot authenticate/connect to github using pyGithub

I am new to using pyGithub and I want to do some updates to issues in an enterprise repository using a python script. I am struggling to get it to connect. I have used similar to this:g=Github(base_url="https://sctigerteam.github.com/api/v3",login_or_token=

tried these 3 ways:

using username and password

g = Github("user", "password")

or using an access token

g = Github("access_token")

Github Enterprise with custom hostname

g = Github(base_url="https://{hostname}/api/v3", login_or_token="access_token")

and none work even though i put in the correct uid/password or access token

g=Github(base_url="https://orgname.github.com/api/v3",login_or_token=""xxxxxxxx" repo = g.get_repo("urlfortherepo")

I get this error and I give it the correct access token because I copy it straight for github. also I do not think I understand the base_url requirements:

raise self.__createException(status, responseHeaders, output)

github.GithubException.BadCredentialsException: 401 {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}

Upvotes: 2

Views: 2205

Answers (2)

lxRbckl
lxRbckl

Reputation: 1

I ran into a similar issue, but instead it was because I had published the token I was using to GitHub, and so GitHub disabled my token.

Creating a new one fixed this issue.

Upvotes: 0

G J
G J

Reputation: 33

resolved i was not putting api/v3 at the end of my url

Upvotes: 1

Related Questions