Is there possibility to get releases with pyGithub
You can get a list of releases from a GitHub repo by making a GET request to
https://api.github.com/repos/{user}/{repo}/releases
Eg
import requests
url = 'https://api.github.com/repos/facebook/react/releases'
response = requests.get(url)
# Raise an exception if the API call fails.
response.raise_for_status()
data = response.json()
Also its worth noting you should be making authenticated requests otherwise you'll hit GitHubs API rate limiting pretty quickly and just get back 403s.
The documentation for PyGithub doesn't mention it, but I believe that pygithub-1.29
(the latest published on PyPi as of today) does in fact contain this API: Repository.py
for the v1.29
tag contains a get_releases()
function.
There is also an open, unmerged pull request that appears to fill out this API to include assets, too.
The question is a bit old but nobody seems to have answered it in the way the OP asked.
PyGithub does have a way to return releases of a repo, here is a working example:
from github import Github
G = Github("") # Put your GitHub token here
repo = G.get_repo("thorium-sim/thorium")
releases = repo.get_releases()
for release in releases:
print(release)
The above will return the following:
GitRelease(title="2.4.1")
GitRelease(title="2.4.0")
GitRelease(title="2.3.0")
GitRelease(title="2.2.0")
GitRelease(title="2.1.0")
GitRelease(title="2.0.0")
...
I hope this is helpful!