Commit Graph
880 Commits
Author SHA1 Message Date
Will Yardley c6802b515f Add support for getting / replacing topics (#634) (#832)
* Add support for getting and replacing topics on a repository #634

* Add / fix tests, accept list vs dict for replace_topics (#634)
2018-07-06 11:09:10 +08:00
Laurent Mazuel faa8f20570 Test Framework improvement (#795)
Hi!

As part of my app, I use this lib, and then your test Framework to record my own upper level tests. Here's some patches I had to make that I humbly think could interest you:

- As stated by @kyogi14 in [this comment](https://github.com/PyGithub/PyGithub/pull/664#issuecomment-389964369), since you use `requests` recording is broken. This fixes that.
- Fix some Python 3 troubles while recording
- Add a `replayDataFolder` gloval class variable, to override the default place to put the recording. Otherwise, if a third party app (like mine :)) has a dependency on PyGithub and wants to use the Framework, recordings are saved in `site-packages/github/tests/ReplayData` instead of my own place.

Hope this helps, please let me know if I can improve the PR.

Thanks!
2018-06-23 11:29:09 +08:00
Maarten Fonville 3aead15818 Handle HTTP 202 HEAD&GET with a retry (#791)
* Handle HTTP 202
Fixes #564
After some testing, it seems GitHub seems to be able to process the chrunching of statistics
for every repository I tested in around 2 seconds. So a delay of around 5 seconds should be
plenty to be very certain that the next try should succeed.
Another option would be to put this value lower and possibly waste an extra retry on it.

* Only re-request data if HEAD or GET (those are 'safe')
to e.g. avoid running a duplicate POST or PUT, that can change stuff on the server
Using RFC 2616 and https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html as guideline

* Fix testStatistics

* change wait time to 2 secs
2018-06-22 16:54:32 +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
Kuba e389396405 GitRelease methods documentation (#821)
Hi, here's my small contribution to the documentation in relation to #819 

Few things:
* the `delete_release` method always returns `True` so not sure if the return type is truly valid - potentially a bug
* I've tried generating the documentation locally to check if formatting is ok but failed - is there a guide to it?   I followed the read the docs starter guide but that didn't seem to reflect the way it's done here
2018-06-20 10:39:06 +08:00
Tim Boring 817f22303c Add remove_membership() method to Teams class (#807)
Per the Github v3 API [docs](https://developer.github.com/v3/teams/members/#deprecation-notice-2), the "remove team member" api is deprecated. This PR implements the new API call.

Deprecated API:
```
DELETE /teams/:team_id/members/:username
```

New API:
```
DELETE /teams/:team_id/memberships/:username
```

This PR also adds a `deprecation` notice to the docstring of the deprecated methods.
2018-06-19 11:19:27 +08:00
per1234 bed4009361 Fix incorrect formatting in docstrings (#816) 2018-06-11 22:24:27 +08:00
MarcoFalke 2bd06255fe Add tests for mergeable state (#801) 2018-05-23 10:15:41 +08:00
Maarten Fonville ba5bf2d76a Include target_commitish in GitRelease (#788) 2018-05-21 17:20:18 +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
Maarten Fonville 0e8ae376a7 Fix Team.description (#797)
fixes #796
2018-05-21 10:32:02 +08:00
Maarten Fonville 23395f5f14 Fix Content-Length invalid headers exception (#787) 2018-05-17 14:05:32 +08:00
sfdye e9e09b9dda Include GitReleaseAsset test, closes #778 2018-05-01 09:40:08 +08:00
Steve Kowalik a519e4675a Remove NamedUser.contributions (#774)
The contributions attribute is no longer sent by Github for NamedUsers,
so remove the attribute.

Fixes #443
2018-04-30 10:12:43 +08:00
Steve Kowalik b1e9ae68a2 Branch protection methods no longer require loki (#775)
The Branch Protection API graduated September 1, 2017, so remove use of
the loki-preview+json header.
2018-04-30 10:10:32 +08:00
Mike Miller 85a9124b09 Add ability to skip SSL verify from requests (#758) 2018-04-26 14:46:44 +08:00
Steve Kowalik bd0cf30970 Correct Repository.get_git_tree recursive use (#767)
The API docs for Repository.get_git_tree specify that the URL parameter
for fetching a tree recursively should be ?recursive=1, not a truthy
value. To not change the API we present, check if it is True before
setting it to 1. Change another callsite of Repository.get_git_tree to
specify recursive=False to make sure it doesn't appear in the query
string.

Fixes #560
2018-04-25 17:21:17 +08:00
Steve Kowalik 85dcc44650 Correct docstring for set_labels (#766)
Both Issue and PullRequest have a set_labels method whose docstring did
not exactly describe the parameter, correct it.
2018-04-23 14:27:18 +08:00
Steve Kowalik e2e29918ea Re-work PullRequest reviewer request (#765)
Add create_review_request() and delete_review_request() methods to
PullRequest, as well as renaming get_reviewer_requests() to
get_review_requests() and cleaning up its return value to firstly respect
teams, and secondly to cut out the middleman of PullRequestReviewerRequests,
which has been removed.

Fixes #597
2018-04-23 14:22:51 +08:00
Steve Kowalik 1f23c06a4d Add support for team privacy (#763)
Teams contain support for privacy, by being either closed, or secret.
Export the string via a property, and allow editing it via the edit
method.
2018-04-20 15:17:58 +08:00
Steve Kowalik 6251212512 PullRequest review methods no longer need black cats (#760)
The preview period of the PullRequest review API ended May 9, 2017 so
remove the custom Accept headers for the relevant methods.
2018-04-19 16:07:52 +08:00
Steve Kowalik 00096c1059 Correct PullRequest.get_reviewer_requests() rtype (#761)
The return type of PullRequest.get_reviewer_requests() is a
PaginatedList containing PullRequestReviewerRequest.
2018-04-19 15:58:24 +08:00
Jasper van Wanrooy c44469965e API outside collaborators (#533)
* API outside collaborators

* Include remaining to organization api calls.
2018-04-19 10:00:15 +08:00
Manu Hortet 980b67f930 Team description added to Team.py (#753)
* team description added to Team.py

* minor correction on initAttributes
2018-04-17 18:22:11 +08:00
Steve Kowalik 0dba048f5c Make use of issue_url in PullRequest (#755)
Clean up some of the issue methods in PullRequest to make use of the
issue_url property, rather than chopping pieces off the URL to replace
/pulls/ with /issues/.
2018-04-17 18:20:56 +08:00
Mike Miller 9aed19ddbe Use 'requests' instead of 'httplib' (#664)
* works (but tests fail)

* Refactor to use python requests rather than httplib

* add requests dependency in setup.py

* touch so travis-ci will run

* clean up some unused comments

* Handle HTTP vs HTTPS; handle custom base_url

* Use requests session

* Don't use a persistent session in tests (which don't use the real requests library)

* Use an older version of requests for python 3.2

Requests dropped support for Python 3.2 in the 2.10 series (though it
didn't detect this until 2.11).

PyGithub probably doesn't need to support Python 3.2 at all; it's quite
old, with negligably few users, but that should be addressed elsewhere.

* Revert "Use an older version of requests for python 3.2"

This reverts commit fb0367614f5413968eeab98f4094e710aa1bc2d1.

* Improve readability

* Update requirements.txt

* Disable custom proxy handling code (unneeded and broken); use requests'

* Remove comment and superflous code

* Fix iteritems() removal from Python3

* pin requests to 2.14.0 or greater in prep for no_proxy

* pin requests to 2.14.0 or greater in prep for no_proxy
2018-04-17 10:25:42 +08:00
Steve Kowalik 678b6b2006 PullRequest labels should use Issues URL (#754)
The Github API docs for PullRequests say to make use of the Issues API
to add, remove, set and query labels. This means that we need to make
use of the issue_url property for the PullRequest, not its own URL.
2018-04-17 10:21:26 +08:00
Steve Kowalik a308dc92df Support labels for PullRequests (#752)
PullRequests can also have labels attached to them, like Issues or
Milestones. Extend PullRequest to also export them if they are present,
as well as adding methods to add, remove and set labels.
2018-04-16 16:43:07 +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
Nicholas Buse a769c2ffc1 Add documentation to github.Repository.Repository.create_git_release() (#747) 2018-04-10 10:16:22 +08:00
Tim Boring 4da483d1c0 Add add_to_members() and remove_from_membership() (#741)
* Add methods add_to_members(), has_in_pending_members(), and remove_from_membership() methods to Organization class.

* Add scrubbed replay files used for testing

* More massaging of test data

* Fix URL to remove organization membership

* Remove `has_in_pending_members()` method
2018-04-09 22:44:22 +08:00
Martin Monperrus fec3c94344 documentation: clarify semantics of get_comments (#743) 2018-04-07 23:41:38 +08:00
Wan Liuyang ca6fbc4552 Add download_url to ContentFile, closes #575 2018-04-06 18:30:43 +08:00
Jess Morgan eaa6a508f3 Add PullRequestComment.in_reply_to_id (#718)
Fix for issue #717
2018-04-06 18:17:20 +08:00
Raihaan 5cb5ab71b3 Add team privacy parameter to create team (#702)
* Add team privacy and add additional parameter to test. Still requires replaydata

* Reorder parameters to not break existing code

* Update tests for #702
2018-04-06 17:08:34 +08:00
Wan Liuyang b54ccc784e Implement License API (#734)
* Implement License API

* Update copyright
2018-04-06 09:17:19 +08:00
Wan Liuyang 911bf61522 Fix delete method for RepositoryKey 2018-04-05 10:25:04 +08:00
Wan Liuyang 722f253429 Remove edit for UserKey as it's immutable now 2018-04-05 10:23:01 +08:00
Mateusz Loskot 42e7593871 Labels API: support description (#738)
The description attribute handling requirement is
  a custom media type in the Accept header:
    application/vnd.github.symmetra-preview+json

Limitation: Repository.get_labels does not report description,
possibly something has changed in the preview API.
2018-03-29 18:16:20 +08:00
Shinichi TAMURA 6bf2acc74d Added Issue.as_pull_request() and PullReqest.as_issue() (#630) 2018-03-26 10:25:45 +08:00
Wan Liuyang ae261c821e Fix a bug for test recording when input is None 2018-03-22 16:38:19 +08:00
Ben Yohay 612c35007e Add support for getting PR single review's comments. (#670) 2018-03-21 20:50:56 +08:00
Laurent Raufaste 5e8c683261 Update the RepositoryKey class (#530)
# The problems I attempt to solve

- `RepositoryKey.created_at` is available on the Github API, but not in
PyGithub
- `RepositoryKey.edit()` is not supported anymore by the Github API,
see https://developer.github.com/v3/repos/keys/#edit-a-deploy-key

# How I went about solving the problem

I added myself a new deploy key to one of my repositories, and recorded
the existing tests using my account.
I could not keep the existing test data as the specified key does not
exist anymore, I added a comment for the next contributor to help him
figure out how to record new tests.
2018-03-21 15:09:31 +08:00
Matt Babineau d85082858e adding since to PR review comments get (#577) 2018-03-21 14:44:10 +08:00
Wan Liuyang 566b28d3fa Remove some duplicate attributes introduced in #522 2018-03-21 14:34:57 +08:00
Daniel Kesler c76e67b737 added tarball_url, zipball_url, prerelease and draft property (#522)
* added tarball_url, zipball_url, prerelease and draft property to GitRelease

* Add tests for new attributes
2018-03-21 14:23:56 +08:00
Hayden Fuss 864c663a16 Source Import API (#673)
* add import source

* add import header

* create/get source import for repo, SourceImport class

* Corrected use_lfs, not considered completed with creation

* vcs creds optional

* SourceImport test, removed unneeded attributes

* create/get source import tests for repo

* Encoding and copyright comment

* styling fixes

* Update SourceImport.py

* Update SourceImport.py

* Update SourceImport.py
2018-03-21 14:04:46 +08:00
Gilad Shefer 162f0397bc Added option to create review for Pull request (#662)
* Added option to create review for Pull request

* Fix tests
2018-03-20 22:28:39 +08:00
Wan Liuyang 3cd176e3c3 Depreciate legacy search API 2018-03-20 20:27:27 +08:00
Michał Górny 10ee17a25c Filter team members by role (#491)
* Team: support filtering members by role

* Team: support adding membership with role
2018-03-17 22:05:13 +08:00