1

I couldn't find anything online so that's why I'm posting it despite the question being simple.

I'm writing a script that download an application's binary and puts it in a file. I would like the use the PyGitHub API to retrieve some information. The problem is that I don't want to enter any credentials when accessing GitHub. I don't need to modify anything, I just want to download the latest release and get information on it. I tried to do it with request, but it's very complicated to use, especially if I only want specific files in the repo. Is there any way I can access the repo using the API without needing credentials?

BloodLord
  • 49
  • 5
  • Do keep in mind that the [rate limits](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting) for unauthenticated requests are quite a bit stricter than those for authenticated requests. If you don't provide credentials, you only get 60 requests per hour before they cut you off, whereas if you provide account credentials, that gets upped to 5000 per hour. – Silvio Mayolo Jun 03 '21 at 17:26
  • @SilvioMayolo That's fine. It's to update only around 30 machines. – BloodLord Jun 03 '21 at 17:27

1 Answers1

1

You can simply pass nothing to the main class, to use the API without authenticating.

from github import Github

g = Github()
r = g.get_repo("REPO_USER/REPO_NAME")
Zeromika
  • 347
  • 2
  • 12