Commit Graph
20 Commits
Author SHA1 Message Date
Enrico Minack 99155806ed Throttle requests to mitigate RateLimitExceededExceptions (#2145)
This introduces a throttling of requests to the Github REST API (1s for writes, 0.25s for reads, configurable)
to mitigate secondary rate limit errors and comply with Github's best practices:

https://docs.github.com/en/rest/guides/best-practices-for-integrators?apiVersion=2022-11-28#dealing-with-secondary-rate-limits
2023-06-28 21:38:29 +02:00
Enrico Minack 0bb72ca004 Retry retryable 403 (rate limit) (#2387) 2023-06-28 12:49:20 -04:00
Giulia Vergottini d514222cb1 Add type stub for MainClass.get_project_column (#2502)
Co-Authored: Attila Dulovics <dulovicsattila@gmail.com>
2023-06-21 21:11:04 +02:00
Enrico Minack ea45237d3b Sync GithubIntegration __init__ arguments with github.Github (#2556)
Github and GithubIntegration now both support the same (full) set of Requester arguments.
Creating a Github instance for a Github App Installation coming from GithubIntegration uses the same
Requester arguments (except for auth).
2023-06-21 09:04:19 +02:00
Enrico Minack f291a368bb Implement AppUserAuth for Github App user tokens (#2546)
Allows to refresh Github App user token. Integrates `ApplicationOAuth` into `github.Auth`.
2023-06-14 19:40:29 +02:00
Enrico Minack fc2d0e150a Add authentication classes, move auth logic there (#2528)
This adds argument `auth` and deprecates `login_or_token`, `password`, `jwt`, and `app_auth` arguments of `github.Github`.

This adds argument `auth` and deprecates `integration_id`, `private_key` of `github.GithubIntegration`.

This deprecates the `create_jwt` method of `github.GithubIntegration`, replaced by `github.Auth.AppAuth.create_jwt`.
2023-06-08 09:17:25 +02:00
5e27c10a31 Support full GitHub app authentication (#1986)
* Support full GitHub app authentication
 Refactor GithubIntegration class and add test case for app authentication
Add permissions and repository properties in InstallationAuthorization
Set JWT_EXPIRY=60 by default in GithubIntegration constructor
* Modify existing testcases for GithubIntegration as per the framework and add missing tests
* Provide installation ID for creating the access token instead of getting the first installation
* Add optional permissions support for installation access token
* Add lock around app authentication
* Keep compatibility for importing GithubIntegration from MainClass
* Group app authentication parameters in a class

Co-authored-by: Malik Ammar Akbar <malikammar.akbar@pfizer.com>
Co-authored-by: Enrico Minack <github@enrico.minack.dev>
2023-02-06 20:50:15 +11:00
Enrico Minack 784a3efd68 Add retry and pool_size to typing (#2151) 2022-10-25 11:34:46 +08:00
Liuyang Wan 7e6333da1a Fix CI (#2330) 2022-10-13 08:56:18 +08:00
Sachi King e4168109dd Use property decorator to improve typing compatibility (#1925)
As a property these functions are expected to be accessed without the
private __get_ and __set_ functions, however while the functions are
typed, the property is not, and mypy shows an attribute error.

As this codebase no-longer requires support for python versions without
support for @property.setter(2.6?) this updates the functions to use
decorators and updates the type files to reflect the attribute
existence.
2021-04-26 14:23:34 +10:00
Omar Brikaa 4cfc9912c0 Added a method for getting a user by their id (#1691)
* Added a method for getting a user by their id

* Added get_user_by_id to MainClass stubs

Fixes #1615
2020-11-10 14:52:58 +11:00
Steve Kowalik 165d995da2 Correct **kwargs typing for search_* (#1636)
It turns out typing for **kwargs is always Dict[str, Type], so only the
type is required.

Fixes #1633
2020-08-06 21:56:09 +10:00
Ethan Roy 8912be6411 Fix type stub for MainClass.get_user (#1637)
-   Add `login` arg default value to stub to match source
2020-08-05 12:40:31 +10:00
Steve Kowalik 3668f866e3 More precise typing for MainClass.get_user() (#1575)
Use typing.overload for MainClass.get_user() since it can return two
disparate types. Correct the docstring for it, as well as locking down
Sphinx to <3 due to built docs issue and drive-by link correction.

Fixes #1550
2020-06-24 16:21:18 +10:00
Denis Blanchette cc1b884c98 Remove "api_preview" parameter from type stubs and docstrings (#1559) 2020-06-18 18:30:33 +10:00
Steve Kowalik 7b20b13d0b Small improvements to typing (#1517)
Work through some of the errors when running mypy with --strict.
2020-05-15 10:47:22 +10:00
Sophie Alpert c7b5eff062 Improve type signature for create_from_raw_data (#1503)
Previously you could call it only on Repository or NamedUser. Now you can call it with any GithubObject subclass -- and the type is carried through to the return value.
2020-05-05 15:51:00 +10:00
Emily 6eba4506d4 Improve type stubs (#1489)
* Add type stubs for GithubException subclasses

* Install type stubs per PEP 561

See https://mypy.readthedocs.io/en/stable/installed_packages.html#making-pep-561-compatible-packages.

* Make PaginatedList a generic type

* Add type stubs for __init__.py

* Add type stub for NamedUser.get_projects

* Add GithubObject superclasses to type stubs

Fixes #1490
2020-05-01 12:00:00 +10:00
Nikolay Edigaryev 5cf9950b25 Ability to retrieve public events (#1481) 2020-04-26 10:03:54 +08:00
Alice GIRARDandLiuyang Wan 91433fe925 Type stubs for mypy (#1231)
* First attempt at stubs

* fix AuthenticatedUser.piy

* fix PullRequest.piy

* fix Authorization.piy

* fix Branch.piy

* fix Clones.piy

* fix Commit.piy

* fix CommitCombinedStatus.piy

* fix CommitComment.piy

* fix CommitStatus.piy

* fix ContentFile.piy

* fix Download.piy

* fix Event.piy

* fix File.piy

* fix Gist.piy

* fix GistComment.piy

* fix GistFile.piy

* fix GitAuthor.piy

* fix GitBlob.piy

* fix GitCommit.piy

* fix GitRef.piy

* fix GitRelease.piy

* renamed stubs into pyi files

* fix Notification

* fix Repository

* fix GitReleaseAsset

* fix GitTag

* fix GitTree

* fix GitTreeElement

* fix GithubException

* fix GithubObject

* fix GitignoreTemplate

* fix HookDescription

* fix HookResponse

* fix InputGitAuthor

* fix Installation

* fix InstallationAuthorization

* fix Invitation

* fix Issue

* fix IssueComment

* Fix random issues found while testing

* fix IssuePullRequest

* fix Label

* fix License

* fix Migration

* fix Milestone

* fix NamedUser

* fix NotificationSubject

* fix Organization

* fix PaginatedList

* fix Path

* fix Permissions

* fix Plan

* fix Project

* fix ProjectCard

* fix ProjectColumn

* fix PullRequestComment

* fix PullRequestMergeStatus

* fix PullRequestPart

* fix PullRequestReview

* fix Rate

* fix RateLimit

* fix Reaction

* fix Referrer

* fix RepositoryKey

* fix RequiredPullRequestReviews

* fix RequiredStatusChecks

* fix SourceImport

* fix Stargazer

* fix StatsCodeFrequency

* fix StatsCommitActivity

* fix StatsContributor

* fix Tag

* fix Team

* fix Topic

* fix UserKey

* fix MainClass

* fix Requester

* added stubs for View

* added stubs for Membership

* various syntax errors

* silence mypy noise

* keeping track of recent changes

* black + isort

Co-authored-by: Liuyang Wan <lwan@zendesk.com>
2020-03-22 19:33:23 +08:00