Commit Graph
113 Commits
Author SHA1 Message Date
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 2475fa669a Raise a FutureWarning on use of client_{id,secret} (#1506)
client_id and client_secret are sent to GitHub encoded on the query
string, which GitHub has firmly deprecated, so much so as to email
people who are doing so. To discourage its use, raise a FutureWarning if
they are specified.

Fixes #1500
2020-05-05 21:23:22 +10:00
Florent Clarret 63855409b9 feature: get the project column by id (#1466)
Add a method to fetch a project column by id.

Fixes #1057
2020-05-01 12:01:09 +10:00
Nikolay Edigaryev 5cf9950b25 Ability to retrieve public events (#1481) 2020-04-26 10:03:54 +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
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
Steve Kowalik 88e30057a7 Remove API preview parameter (#1325)
The API preview flag for both MainClass and Requester was the last
hard-coded custom header, and it seems to not be relevant since
mid-2015. Remove it, if any users are using it, they shouldn't be. Its
code path was also entirely untested.
2019-12-29 10:49:45 +11:00
Wan Liuyang 540a085001 Fix isort - add known first and third party 2019-12-11 00:54:59 +08: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 e33858a3dc Support non-default URLs in GithubIntegration (#1229)
The get_installation() method of GithubIntegration was hardcoded to
always use the default URL of api.github.com, making it impossible to
fetch the installation of an GitHub Enterprise installation.
2019-09-25 23:01:31 +10:00
Jake Klingensmith 850da5af27 Fix redundant int checks (#1226) 2019-09-23 16:28:07 +10:00
Steve Kowalik a0f01cf9cf Remove more Python version specific code (#1193)
Remove a bunch of other call sites that behaved differently between
Python 2 and 3, massively cleaning up a few messy methods.
2019-08-28 15:24:54 +10: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
Steve Kowalik 6e79d2704b Correct return type of MainClass.get_organizations (#1179)
The doc string and the code disagreed about the return type of
MainClass.get_organizations(), correct the code, which was incorrect.

Fixes #1177
2019-07-23 22:38:36 +10:00
Steve Kowalik 828b53b756 Silence more flake8 errors (#1160)
Make more whitespace changes to silence flake8 errors under the github
directory only.
2019-07-02 17:55:04 +08:00
Steve Kowalik b8dad9817e Clean up a lot of pyflakes warnings (#1153)
Clean up unused imports or unused variables to mostly silence pyflakes.
We aren't quite yet in a place where we can run it via Travis, but baby
steps.
2019-07-02 18:06:09 +10:00
chillipeper 6cd0d644cf Add support for custom base_url in GithubIntegration class (#1093)
* Add support for custom base_url in GithubIntegration

* Fix non default argument issue
2019-06-20 16:08:04 +08:00
Tomas Tomecek 18187045a4 GithubIntegration: enable getting installation (#1135)
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2019-06-20 16:05:53 +08:00
Caleb Sweeney 54065792b8 fixes #1106 for GitHub Enterprise API (#1110) 2019-05-03 09:24:59 +08:00
Jake Wilkins 818bd78fe9 Use non-deprecated path for creating GitHub App access tokens (#1086)
/installations/<installation_id>/access_tokens was deprecated as of
https://developer.github.com/changes/2018-08-16-renaming-and-deprecation-of-github-app-installation-access-token-route/
2019-04-10 10:11:06 +08:00
Isac Souza 5ae7af55ea Adding communications Retry functionality into requests via urllib3 retry object. (#1002)
This is a continuation of the work started by @allevin on https://github.com/PyGithub/PyGithub/pull/860.

I have refactored the testing Framework to use the `httpretty` library in order to use the urllib3 retry feature and therefore be able to test it.

Please refer to https://github.com/PyGithub/PyGithub/pull/860 for additional context.

cc: @allevin @mfonville @jrouquie @sfdye

Closes #757 
Closes #860
2019-04-05 13:49:01 +08:00
Wan Liuyang 6efd631890 Remove status API, closes #1080 2019-04-04 13:54:09 +08:00
Hamel Husain 86a9d8e973 provide option to extend expiration of jwt token (#1068)
supply optional parameter for `create_jwt` method
2019-03-29 15:37:36 +08:00
秋葉 6a89eb645d resolves #1023 (#1042)
resolves #1023
2019-02-14 10:50:11 +08:00
秋葉 ff789dcc81 fix request got an unexpected keyword argument body (#1012)
Resolves #1010
2019-01-18 15:37:08 +08:00
Benoit Latinier cd6d56d60a Drop httplib for requests to finish work of #664 (#998)
#664 got rid of most of httplib and replaced it with requests.
This is the last place it was used. It makes a more coherent code base I think.

Tests are ok locally.
2018-12-20 10:51:57 +08:00
Steve Kowalik e4dac15e86 Add a Topic object to cover search_topics (#959)
The return value of MainClass.search_topics() was a paginated list of
Repository, which is incorrect. Add a Topic class to encapuslate what is
returned.

Fixes #929
2018-11-13 10:18:29 +08:00
Arda Kuyumcu 8ccf9a9485 Add support for JWT authentication (#948)
APIs such as https://developer.github.com/v3/apps/#find-organization-installation use a JWT for authentication. Adding support for JWT auth.
2018-10-31 08:11:50 +08:00
h.shi 1fa25670f7 Add highlight search to search_code function (#925)
*  add highlight search to search_code function

*  add highlighting search code tests
2018-10-10 16:38:47 +08:00
Bruce Richardson e18b107883 Gists with since (#914)
The Github gists api has a since parameter for the various gist searches.  This adds that parameter to Github.get_gists(), NamedUser.get_gists() and Authenticator.get_gists().  Tests and replay data added/updated as needed.

I added a Time module in the tests directory, containing just a UTCtzinfo class, which I felt I needed for one of the tests (and would probably be useful in other since/until tests).  Might not be the best name for the module but it seemed the least invasive thing to do.
2018-10-03 11:51:59 +08:00
Yossarian King faca4ce1c0 Add support for projects (#854)
Initial solution for [PyGithub support for projects](https://github.com/PyGithub/PyGithub/issues/606) (#606). Adds comprehensive project querying API.

Currently does not support for modifying projects, columns or cards. (I only need this interface for reporting purposes. Of course once I'm done others are more than welcome to add additional features!)

API that was integrated:
https://developer.github.com/v3/projects
https://developer.github.com/v3/projects/columns
https://developer.github.com/v3/projects/cards

Note that the Github project API is in preview mode - it requires a special header in order for requests to be processed, and the API is subject to change without notice.

## Summary
- new classes: Project, ProjectColumn, ProjectCard
- add Organization.get_projects method
- add Repository.get_projects method
- add MainClass.get_project method
- add test cases to exercise all new classes and methods and verify attributes are as expected; replay data is included, recorded (mostly) from my fork of PyGithub
- updated add_attribute script to:
  - use makeXXXAttribute API
  - be able to add to the end of the current set of properties
  - handle both Completable and NonCompletable class types correctly

## Checklist
Not to be merged until these are done:

- [x] remaining Project properties
- [x] remaining ProjectColumn properties
- [x] remaining ProjectCard properties
- [x] support for archived_state parameter when getting cards: all,archived, or not_archived
- [x] get issue from card, not just pull request ("get_content" method?)
- [x] centralize header management for "preview" access to projects API
- [x] add test for retrieving organization projects
- [x] add test for getting issue / pull request content from card
2018-09-11 13:05:16 +08:00
Shubham Singh 3ce0418382 Feature: Search By Topics (#893) 2018-09-06 11:44:53 +08:00
Wan Liuyang fd8a03648a Adding support for search/graphql rate limit, fixes #553 2018-09-05 12:33:20 +08:00
Steve Kowalik 6732517c1d Change MainClass.get_repo default laziness (#882)
MainClass.get_repo() used to default to lazy fetching, which is not what
NamedUser.get_repo() does, so change the default. Fix the tess to pass
lazy=True, so that we don't need to grow 8 ReplayData files with 11
lines of the repository in question.

Fixes #353
2018-08-27 11:57:58 +08:00
Wan Liuyang ae5cdb285e Refactor common header constants and custom media type 2018-08-21 15:01:23 +08:00
Wan Liuyang 3f0caa4057 Sync copyright header 2018-08-19 10:47:41 +08:00
Maarten Fonville 8bdac23ca1 Fix github API requests after asset upload (#771)
In the old code the self.__hostname would be overwritten with uploads.github.com
but it could not be correctly re-set to api.github.com after completing the upload
Create a separate connection if hostname or port differ in requestBlobAndCheck

in the end this became quite a large overhaul, to also make this change generic
for e.g. connecting to status.github.com and similar methods

~~not sure if tests need (more) updating, if so I will update the PR accordingly~~
2018-06-22 12:46:46 +08:00
Joshua Hoblitt 140c648075 increase default timeout to be > github request timeout (#793)
* increase default timeout to 15s

* Update MainClass.py
2018-05-21 10:39:33 +08:00
Mike Miller 85a9124b09 Add ability to skip SSL verify from requests (#758) 2018-04-26 14:46:44 +08:00
Svend Sorensen 1e0150b527 Add get_organizations() (#748)
* Add get_organizations()

* Add unit tests for get_organizations
2018-04-12 08:50:42 +08:00
Wan Liuyang b54ccc784e Implement License API (#734)
* Implement License API

* Update copyright
2018-04-06 09:17:19 +08:00
Wan Liuyang 3cd176e3c3 Depreciate legacy search API 2018-03-20 20:27:27 +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
Wan Liuyang a32a17bf81 Fix broken Github reference link in class docstrings 2018-03-13 15:07:07 +08:00
Agor Maxime aa556f85a1 Finished search_commits PR (#727)
* Added support for newer commit search API endpoint

* Added tests for new commit search method on main Github class

* Fixed sort parameter of search_commits
2018-03-09 08:00:47 +08:00