Commit Graph
45 Commits
Author SHA1 Message Date
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
Enrico Minack 17cd0b7964 Raise error on unsupported redirects, log supported redirects (#2524) 2023-05-13 20:36:08 +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
Steve Kowalik e113e37de1 Add pyupgrade to pre-commit configuration (#1783)
To help us switch to f-strings and other 3.6+ changes, add pyupgrade to
our pre-commit configuration to keep the codebase clean.
2020-12-15 14:07:33 +11: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
Liuyang Wan 546d601b50 Fix all type issues flagged by mypy (#1484) 2020-04-26 12:40:05 +08:00
Steve Kowalik 83bef0f7b2 Correct typos found with codespell (#1467)
Correct misspellings and typos located using the codespell tool. Add
codespell to pre-commit to avoid further regressions.

Fixes #1459
2020-04-16 13:25:01 +10:00
Steve Kowalik 0ebdbb2675 Export IncompletableObject in the github namespace (#1450)
When IncompletableObject was added, it was only added to
GithubException, and not imported directly into the github namespace
like other exceptions. Correct that, and clean up the resultant now
unrequired import.
2020-04-15 10:52:13 +10: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
Steve Kowalik b7894ea00c Drop Python 2 support (#1329)
With the Python 2 deadline gone, it's time to move with the times and
switch to Python 3 only.
2020-01-06 18:01:38 +11:00
Wan Liuyang 6ceb9e9a15 Apply black to whole codebase (#1303) 2019-12-10 17:14:33 +08:00
Adam Baratz a076508370 Stop ignoring unused imports and remove them (#1250)
* Stop ignoring unused imports and remove them

* Stop ignoring * imports
2019-10-19 16:43:14 +11:00
Steve Kowalik dc2f2ad8cb Switch to using six (#1189)
With the Python 2.7 deadline fast approaching, modernize the codebase
making use of the modernize module to switch to using six, as well as
other upcoming features, such as absolute imports . Stop using 2to3
for Travis, yay!
2019-08-05 14:06:19 +10:00
Wan Liuyang de6b713b05 Force absolute import, fixes #314 2018-08-24 15:08:18 +08:00
sfdye 365a0a24d3 Apply fix_headers script to update copyright info 2018-03-17 20:06:16 +08:00
sfdye 58e1ef9ccb Fix copyright formatting 2018-03-13 22:30:47 +08:00
sfdye 020c136a40 Update doc link in copyright text 2018-03-13 22:07:38 +08:00
sharkykh 67b078e920 Import missing exception
TwoFactorException was missing on GithubException import line
2017-02-21 00:51:50 +02:00
Jannis Gebauer d60943db8c adds GitHub integrations 2016-09-15 15:39:43 +02:00
Peter Buckley cb0cf0a680 update doc url everywhere (#420) 2016-07-12 16:38:02 -04:00
Vincent Jacques abca7a026e pep8
This is strange, maybe Cygwin's version is stricter.
No time to investigate.
2014-05-04 12:54:05 -07:00
Vincent Jacques 072bf24277 Raise exception only when user *accesses* an attribute with a bad value (#195) 2013-09-12 11:45:29 +02:00
Vincent Jacques 06a3d87098 Change source file header format 2013-07-13 19:03:53 +02:00
Vincent Jacques db2a9db721 Add two new types of exceptions (issue #152) 2013-05-17 14:27:17 +02:00
Vincent Jacques 73f9ae8f21 Merge branch 'topic/SpecificExceptions' into develop 2013-04-22 22:23:04 +02:00
Vincent Jacques db5560bd65 Add a script to check copyrights with git log. And fix copyrights. 2013-03-29 16:54:15 +01:00
Vincent Jacques 0bc368973a Raise a specific exception for non-existing objects (issue #152) 2013-03-29 13:10:59 +01:00
Vincent Jacques 7b3e4c15ed Raise a specific exception for bad credentials (issue #152) 2013-03-29 13:01:06 +01:00
Vincent Jacques 1c47be4e89 Document #pragma no covers (Issue #154) 2013-03-28 21:50:17 +01:00
Vincent Jacques a397fac6db Fix doc for raw_data (issue #144) 2013-03-21 21:56:51 +01:00
Vincent Jacques a39f421ca2 Avoid confusion between github/ and Github.py on case-insensitive file systems (#143) 2013-03-12 10:16:06 +01:00
Vincent Jacques 7a415fda66 Change home page 2013-02-16 21:19:49 +01:00
Vincent Jacques 20d0e1e6d6 Improve 2013-02-07 19:02:47 +01:00
Vincent Jacques 131aeeab3f Fix tests and some doc 2012-12-29 08:23:58 +01:00
Vincent Jacques 889e57df22 Improve docs 2012-12-29 08:13:22 +01:00
Vincent Jacques 54554b280d Improve 2012-11-27 21:14:30 +01:00
Zearin 4c6a70c24a Add encoding comment to source files
This is a minor thing.  It’s a convention, not a rule (obviously)—but it’s also a best practice.

Many text editors look for this kind of comment as the first line—or second line, if there is a shebang (the `#!/usr/bin/env python`, or whatever else)—and make use of this to determine the file’s encoding.
2012-11-01 11:43:56 -04:00
Vincent Jacques ca1e799826 Restore measure of test coverage 2012-10-28 15:53:03 +01:00
Vincent Jacques 431d9701d7 Follow pep8 2012-09-25 23:13:13 +02:00
Vincent Jacques a13ce33beb Improve logging (related to #88) 2012-09-25 22:56:43 +02:00
Vincent Jacques f9dd406465 Test the logging facility 2012-09-17 19:28:29 +02:00
Vincent Jacques 41c2b94f95 Add a copyright and license notice (issue #16) 2012-06-03 19:56:33 +01:00
Vincent Jacques 9820c58477 Move generated code to 'github' instead of 'src/github' 2012-06-02 13:06:28 +01:00
Vincent Jacques d631e83b79 Move files around 2012-05-10 18:10:17 +02:00
Vincent Jacques d9e79948b9 First integration test 2012-02-12 16:33:27 +01:00