Questions tagged [pygithub]

PyGitHub is a Python library implementing the GitHub REST API v3, to manage GitHub resources (repositories, user profiles, organizations, etc.) from Python scripts.

PyGitHub is a Python library implementing the GitHub API v3, to manage GitHub resources (repositories, user profiles, organizations, etc.) from Python scripts.

See also

210 questions
4
votes
1 answer

GitHub "Requires Authentication" error when using PyGithub

I was trying to figure out how to use the PyGithub module, but I keep getting the same error: github.GithubException.GithubException: 401 {"message": "Requires authentication", "documentation_url":…
user15966297
4
votes
1 answer

Return only issues using PyGithub

I'm trying to get the number of issues in a repository, but the code below is returning issues and pull requests. How do I just get issues? I think I'm missing something simple here. I read the api documentation and it states GitHub treats all…
DBS
  • 1,107
  • 1
  • 12
  • 24
4
votes
1 answer

How to create a file inside a repository using PyGithub?

As the documentation suggests, calling create_file on a github.Repository.Repository object should create a file but I am getting github.GithubException.UnknownObjectException. My code is like this: `repo.create_file('filename', 'commitmessage',…
Abhishek Kumar
  • 298
  • 4
  • 10
4
votes
1 answer

PyGithub search qualifiers, how to use

I'm looking to do a search of github users using the PyGithub library function: github.search_users('Keyword', qualifiers = {'location':'San Francisco}) The documentation says: search_users(query, sort=NotSet, order=NotSet, **qualifiers) Calls: …
Tevon Strand-Brown
  • 1,283
  • 3
  • 16
  • 28
3
votes
2 answers

How to upload an image file to Github using PyGithub?

I want to upload an image file to my Github Repository using Pygithub. from github import Github g=Github("My Git Token") repo=g.get_repo("My…
3
votes
0 answers

How can I speed up get requests from the PyGithub libary?

If I am not mistaken, you can't speed up individual HTTP requests, but there are ways to speed up multiple requests through asynchronous functions and caching. Below is an example of a function that prints all the release assets in a GitHub…
3
votes
1 answer

can you delete a repo via pygithub?

Can you delete a repo using pygithub? For example, as shown in this example, you can delete a file like so: repo = g.get_repo("userName/repoName") contents = repo.get_contents("filename.txt", ref="test") repo.delete_file(contents.path, "remove…
Mathew
  • 1,116
  • 5
  • 27
  • 59
3
votes
1 answer

PyGitHub - Error 403 {"message": "This API returns blobs up to 1 MB in size

I am working on a Python script to automatically create files on Github and if they exist, update them. I am using the module PyGithub with the logic below. The problem I have is that when I try to update a file that is bigger that 1Mb, I…
R.Luzardo
  • 43
  • 4
3
votes
1 answer

How to create a new directory in a repo using PyGithub?

Just as we can create new files in a Github repo using PyGithub, can we create directories/folders in a Github repo using PyGithub? I have been searching through the PyGithub docs but I haven't found anything substantial.
Saurav Saha
  • 745
  • 1
  • 11
  • 30
3
votes
2 answers

How to download a GitHub release asset from a private repository in python?

I'm using pygithub and i'm getting the proper assets I want to download, but I can't figure out how to actually get them because they're in a private repository. I've found similar questions here and here but I'm looking for a Python (3.7)…
Ofer Sadan
  • 11,391
  • 5
  • 38
  • 62
3
votes
1 answer

How do I create a remote git repository on my github account with python or push a local git repo to my github account using python?

I'm new to python. What I'm trying to do is to create a remote git repository on my GitHub account and then be able to clone it locally. I want to do all this in a python program. If it is easier to create a local git repo and then push it to my…
Gboy
  • 31
  • 3
3
votes
1 answer

PyGitHub: Get Total number of commits for a repository

I am trying to get total number of Commits for each repository for repositories using Python GitHub. Code: from github import Github git = Github("token") org = git.get_organization('organization') for repo in org.get_repos(): …
Tjs01
  • 457
  • 2
  • 8
  • 14
2
votes
0 answers

How to get all users in organization in GitHub using PyGithub? I'm getting github.GithubException.UnknownObjectException

I would like to print all users in my organization in GitHub using PyGitHub. The below snippet works, however it returns a PaginatedList: python3 -c 'import os; from github import Github;g = Github(os.environ["TOKEN"]); repo =…
mazix
  • 2,540
  • 8
  • 39
  • 56
2
votes
1 answer

ModuleNotFoundError: No module named 'github'

trying to import github (PyGithub) but it keeps giving the same error, even though the lib is fully installed. Code: from github import Github Output: Traceback (most recent call last): File "...path", line 1, in from github import…
Quarlie
  • 21
  • 1
  • 2
2
votes
2 answers

PyGithub repository.get_pulls parameter options?

I'm using Python's PyGithub library and want to get a list of closed prs in order from the ones most recent closed to the oldest ones closed. However, the PyGithub documentation doesn't show what options I have available for the parameters…
1
2
3
13 14