Use new pygithub global lazy feature

Requires 2.6.0. Means data is only fetched if it is accessed,
so fewer API calls for us (hopefully).
This commit is contained in:
Christoph Reiter 2025-03-07 11:09:22 +01:00
parent ca6dd299ee
commit 1ef3f8f5f5
3 changed files with 3 additions and 2 deletions

View File

@ -72,6 +72,7 @@ def get_github(write: bool = False) -> Github:
kwargs['per_page'] = 100
kwargs['timeout'] = sum(REQUESTS_TIMEOUT)
kwargs['seconds_between_requests'] = None
kwargs['lazy'] = True
gh = Github(**kwargs)
if auth is None and not write:
print(f"[Warning] Rate limit status: {gh.get_rate_limit().core}", file=sys.stderr)

2
poetry.lock generated
View File

@ -927,4 +927,4 @@ files = [
[metadata]
lock-version = "2.1"
python-versions = "^3.10"
content-hash = "8137910be83a0332aa71d0b3db583e40b251c17e9238f537a47d7fd892a16850"
content-hash = "a3bec96df66794a5e5342117a9c6d70dce2cc233611f0479275c8eed6dc54211"

View File

@ -6,7 +6,7 @@ authors = ["Christoph Reiter <reiter.christoph@gmail.com>"]
[tool.poetry.dependencies]
python = "^3.10"
PyGithub = "^2.1.1"
PyGithub = "^2.6.0"
tabulate = "^0.9.0"
requests = "^2.28.1"
requests-cache = "^1.0.0"