Skip to content

Make requester a public attribute#3056

Merged
EnricoMi merged 3 commits intoPyGithub:mainfrom
minrk:public-requester
Oct 9, 2024
Merged

Make requester a public attribute#3056
EnricoMi merged 3 commits intoPyGithub:mainfrom
minrk:public-requester

Conversation

@minrk
Copy link
Copy Markdown
Contributor

@minrk minrk commented Oct 9, 2024

There will always be new APIs not yet supported by PyGitHub (e.g. #2718). This adds an escape hatch for users to send requests directly without having to start from scratch or use private APIs while waiting for PyGitHub to add support.

Changes:

  • private object._requester .__requester is now available via public .requester attribute on MainClass, GitHubObject, etc.
  • add Requester APIs to docs as public methods, indicating status as stable public APIs

Fixes #2071 which received only positive feedback, but was closed for inactivity.

as an escape hatch for unsupported APIs

- accessible as `Github.requester` or `GitHubObject.requester`
- add public Requester methods to docs
@minrk

This comment was marked as off-topic.

@EnricoMi EnricoMi changed the title make requester a public attribute, enabling requests to unsupported APIs Make requester a public attribute Oct 9, 2024
@EnricoMi EnricoMi mentioned this pull request Oct 9, 2024
Copy link
Copy Markdown
Collaborator

@EnricoMi EnricoMi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also test the requester property on one GithubObject implementation, e.g. Repository.

@EnricoMi
Copy link
Copy Markdown
Collaborator

EnricoMi commented Oct 9, 2024

This looks reasonable to do.

Copy link
Copy Markdown
Collaborator

@EnricoMi EnricoMi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@EnricoMi EnricoMi added this pull request to the merge queue Oct 9, 2024
@EnricoMi
Copy link
Copy Markdown
Collaborator

EnricoMi commented Oct 9, 2024

Thanks for the contribution!

Merged via the queue into PyGithub:main with commit c44ec52 Oct 9, 2024
@flatherskevin
Copy link
Copy Markdown

When is this scheduled for release? (Disclaimer I couldn't find release practices elsewhere in the repo, so I figured I would comment directly here)

@wyardley
Copy link
Copy Markdown
Contributor

Seems like this was released in 2.5.0

Is this usable on the repo or org objects? I see repo._requester but not repo.requester?

Seems like a great feature - would be great if there were one or two examples in the docs. Is there a good example of this in use somewhere?

@minrk minrk deleted the public-requester branch December 11, 2024 16:53
atodorov added a commit to kiwitcms/github-app that referenced this pull request Apr 18, 2025
atodorov added a commit to kiwitcms/github-app that referenced this pull request Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a way to make a "raw" request

4 participants