Closed
Description
Hi,
First of all, thank you very much for this nice project!
While testing a simple pagination described in the docs, I found an error trying to paginate /issues
.
Env
- python: 3.12
- githubkit: 0.12.11
Steps to reproduce
from githubkit import GitHub
kit = GitHub()
owner="UKPLab"
repo="sentence-transformers"
issues = [
issue.title
for issue in kit.rest.paginate(
kit.rest.issues.list_for_repo,
owner=owner,
repo=repo,
state="all",
per_page=100
)
]
Error
RuntimeError Traceback (most recent call last)
Cell In[3], line 2
1 it = (issue.title for issue in kit.rest.paginate(kit.rest.issues.list_for_repo, owner=owner, repo=repo, state="all", per_page=100))
----> 2 issues = list(it)
Cell In[3], line 1, in <genexpr>(.0)
----> 1 it = (issue.title for issue in kit.rest.paginate(kit.rest.issues.list_for_repo, owner=owner, repo=repo, state="all", per_page=100))
2 issues = list(it)
File ~/.venv/lib/python3.12/site-packages/githubkit/rest/paginator.py:102, in Paginator.__next__(self)
100 def __next__(self) -> RT:
101 while self._index >= len(self._cached_data):
--> 102 self._get_next_page()
103 if self.finalized:
104 raise StopIteration
File ~/.venv/lib/python3.12/site-packages/githubkit/rest/paginator.py:169, in Paginator._get_next_page(self)
167 raise RuntimeError("Request method is not set, this should not happen.")
168 if self._response_model is None:
--> 169 raise RuntimeError("Response model is not set, this should not happen.")
171 # we request the next page with the same method and response model
172 response = cast(
173 Response[Any],
174 self.rest._github.request(
(...)
179 ),
180 )
RuntimeError: Response model is not set, this should not happen.
Potential solution
I think the issue is that the self._response_model
is not initialized here. Tweaking the code locally to initialize this variable solved my problem.
Questions
- Could you please confirm that this is the root cause of the issue?
- If so, when can I expect a new version of this library (with a fix included) to be released? (I can open a PR if needed)
Thank you in advance!