recv_hdrs issue with parallel headers

Open
#36 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
github, python
Domain
api

Research direction

Start with the documentation example using GhApi, pages, and api.last_page(), then inspect ghapi/page.py at last_page and ghapi/core.py where recv_hdrs is accessed. Trace how the parallel-pages request populates response headers and compare that with the example. Done means the documented example no longer raises AttributeError.

Written by the indexing model from the issue text.

Description

When following the documentation on parallel pages

gh_repos = pages(api.repos.list_for_org, api.last_page(), 'github').concat()
len(gh_repos)

I get the following error:

File "/workspaces/test/github.py", line 25, in <module>
    gh_repos = pages(api.repos.list_for_org, api.last_page(), 'github').concat()
  File "/home/vscode/.local/lib/python3.9/site-packages/ghapi/page.py", line 57, in last_page
    header = self.recv_hdrs.get('Link', '')
  File "/home/vscode/.local/lib/python3.9/site-packages/ghapi/core.py", line 116, in __getattr__
    def __getattr__(self,k): return self.groups[k] if 'groups' in vars(self) and k in self.groups else stop(AttributeError(k))
  File "/home/vscode/.local/lib/python3.9/site-packages/fastcore/basics.py", line 202, in stop
    raise e
AttributeError: recv_hdrs

Should I have extra parameters in my api initialization? I currently am just doing

api = GhApi(token="abunchofrandomchars")
Dominant language
Python
Stars
687
Forks
69
Avg merge
1m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AnswerDotAI/ghapi

All issues in AnswerDotAI/ghapi

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.