Commit Graph
968 Commits
Author SHA1 Message Date
Steve Kowalik 8d2a6b534d Allow name to be specified for upload_asset (#1151)
GitRelease.upload_asset() calculates the name based on the filename, and
doesn't allow it to be overridden. Add a new name argument that is used
if it is set. Drive by changing the default of the content_type argument
to NotSet.

Closes #1095
2019-06-24 15:14:23 +08:00
Pascal Bach 03939fe55c Fix assertion in add_to_members (#1146)
The role parameter is set to NotSet by default
but the assertion only allowed str and unicode.
So it would always fail. Add NotSet to the assertion
to allow calling the function without a role.

Signed-off-by: Pascal Bach <pascal.bach@nextrem.ch>
2019-06-21 10:01:15 +08: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
Geoffroy Jabouley ef6f009dc3 Add sorting capability to Organization.get_repos() (#1139) 2019-06-20 15:51:55 +08:00
Steve Kowalik 4349bca136 Add new Organization.get_team_by_slug method (#1144)
Add a new API call to Organization that allows fetching teams by
slug.

Closes #1116
2019-06-20 15:40:20 +08:00
Brian Choy 4a37860bc4 Add description field when creating a new team (#1125) 2019-05-23 08:07:53 +08:00
Steve Kowalik 102c820806 Handle a path of / in Repository.get_contents() (#1070)
The path requested in Repository.get_contents() is appended to the URL,
so the root path should be requested with the empty string. If path is
'/', set it to the empty string. Copy the replay data from the original
test, since it is identical.

Drive-by renaming the test to include the missing 's'.

Closes #1059
2019-05-22 15:10:27 +08:00
Wan Liuyang 3d43e9c0e6 update doc, fix #1123 2019-05-21 10:02:14 +08:00
Wan Liuyang 01737a13f8 Merge get_file_contents with get_contents 2019-05-07 10:47:22 +08:00
Filipe LaínsandWan Liuyang ec7bbcf586 issue: add lock/unlock (#1107)
* issue: add lock/unlock

* tests: add test for issue lock/unlock

* tests: add lock/unlock sample data

* Fix tests, add locked and active_lock_reason


Co-authored-by: Wan Liuyang <tsfdye@gmail.com>
2019-05-06 09:38:05 +08:00
Caleb Sweeney 54065792b8 fixes #1106 for GitHub Enterprise API (#1110) 2019-05-03 09:24:59 +08:00
TechnicalPirate 78d283b9b5 Updated setup.py to exclude tests (#1031)
# Problem #
The `.whl` available on PyPi for this repository contains its entire `tests` submodule. 

The total size of the `pygithub` module is less than `1mb` without tests and `>23mb` with. 

Previous discussions on this topic indicated the removal of tests would be accepted if someone created a pull request to do so: https://github.com/PyGithub/PyGithub/issues/672 

This is that pull request! 😄

# Solution/Implementation # 

- Moved "tests" to root of the repository ( outside the package ) 
    - Added `tests.` module path to the imports in `AllTests.py`
- Updated `setup.py`
    - Removed `package_data` from product
    - Removed "tests" from packages definition
    - Repointed `test_suite` to new location
- Updated `travis.yml`
    - Added conditional ( if not `py2.7` ) conversion of code to `py3`

_... apologies for all the failed build spam below - new to working with Travis CI / had some gotcha moments!_
2019-04-16 11:45:02 +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
Alex 293846bee3 Add url parameter to include anonymous contributors in get_contributors() (#1075)
Add the anon parameter missing from get_contributors() so anonymous contributors can be included in results as specified in the [Github REST API Reference](https://developer.github.com/v3/repos/#list-contributors).
2019-04-05 13:51:40 +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
Jon Dufresne 74c3040ae4 Run pyupgrade across the project (#1067)
https://github.com/asottile/pyupgrade

- Use dict comprehension
- Use set literals
2019-03-29 15:43:37 +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
Jamie van Brunschot 7ee6c41753 add since and before to get_notifications (#1074)
Needed this for getting notifications in a certain period and noticed that it wasn't implemented.
2019-03-29 15:22:57 +08:00
MurphyZhao 118def30a3 [fix] the default vaule of 'PullRequest.create_review'`s commit param (#1058)
[fix] the default vaule of github.PullRequest.PullRequest.create_review`s input param commit.

In `POST /repos/:owner/:repo/pulls/:number/reviews`, 'commit_id' is not a necessary parameter.Reference [https://developer.github.com/v3/pulls/reviews/](https://developer.github.com/v3/pulls/reviews/)

Signed-off-by: MurphyZhao <d2014zjt@163.com>
2019-03-13 10:47:38 +08:00
Steve Kowalik 8ef71b1b37 Add new dismiss() method on PullRequestReview (#1053)
The GitHub v3 API has the ability to dismiss reviews, export it by way
of a new dismiss() method on PullRequestReview.

Closes #1050
2019-02-28 10:11:30 +08:00
秋葉 6a89eb645d resolves #1023 (#1042)
resolves #1023
2019-02-14 10:50:11 +08:00
Raihaan 480f91cf1d Fix Organization.add_to_members() role passing (#1039)
* Fix role passing

* Fix typo

* Fix another typo

* Move parameter to JSON payload

* Move parameter to JSON payload

* Add content type

* Add content type

* Double Quotes

* Double quotes
2019-02-12 14:39:44 +08:00
Vincent d6ba5d7235 fixed: comment of ProjectColumn.create_card (#1041) 2019-02-12 14:37:01 +08:00
秋葉 ff789dcc81 fix request got an unexpected keyword argument body (#1012)
Resolves #1010
2019-01-18 15:37:08 +08:00
Benoit Latinier 5f5c276465 add: create project column card route (#1003)
Add the missing route to create cards for projects columns
Test written and passing locally.
2019-01-18 11:51:04 +08:00
Surya Teja 10bacb486a user.node_id missing (#1001)
'node_id' attribute was missing. Hence added the attribute using add_attribute script in AuthorizedUser  and NamedUser classes. 
This fixes issue #999 .
2019-01-10 20:49:52 +08:00
Steve Kowalik b51227681d Add missing import to PullRequest (#1007)
PullRequest.get_review_comments() works with no arguments passed due to
if short circuiting, but as soon as you pass since, you get an exception
since datetime wasn't imported. Import it, and add a test case for good
measure.

Closes #1004
2019-01-04 22:28:54 +08:00
Shubham Singh b4d895eddd Adding migration api wrapper (#899)
Closes #818
2018-12-21 12:01:01 +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
Benoit Latinier 1c0fd97d7d Add "create repository project" and "create project column" methods (#995)
Added the two methods:
 - Create a project for a given repo
 - Create a column for a given project 

Tests are basics but done :)
2018-12-20 10:48:54 +08:00
Justin Kufro a433a2fe3d Traffic Endpoints Support (#977)
Added support for the traffic endpoints found at https://developer.github.com/v3/repos/traffic/.

We added four functions to the Repository class (one for each of the endpoints) with corresponding unit tests. 

Fixes #926
2018-12-05 09:54:31 +08:00
Ggicci aca50a7581 Change type of GitRelease.author to NamedUser (#969)
Github's release object in the API response contains an `author` field having a value much more like a `NamedUser` but not `GitAuthor`.

e.g. https://api.github.com/repos/edhollandAL/PyGithub/releases/1210902

```
{
  "id": 1210902,
  "author": {
    "login": "edhollandAL",
    "id": 11922660,
    "node_id": "MDQ6VXNlcjExOTIyNjYw",
    "avatar_url": "https://avatars1.githubusercontent.com/u/11922660?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/edhollandAL",
    "html_url": "https://github.com/edhollandAL",
    "followers_url": "https://api.github.com/users/edhollandAL/followers",
    "following_url": "https://api.github.com/users/edhollandAL/following{/other_user}",
    "gists_url": "https://api.github.com/users/edhollandAL/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/edhollandAL/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/edhollandAL/subscriptions",
    "organizations_url": "https://api.github.com/users/edhollandAL/orgs",
    "repos_url": "https://api.github.com/users/edhollandAL/repos",
    "events_url": "https://api.github.com/users/edhollandAL/events{/privacy}",
    "received_events_url": "https://api.github.com/users/edhollandAL/received_events",
    "type": "User",
    "site_admin": false
  },
  // (ignored)
}
```
2018-11-25 09:56:38 +08:00
Steve Kowalik ec17761008 Use total_count from data in PaginatedList (#963)
When there is no link header sent, this signifies that this is the only
page of results. If data is empty, or only contains a list of items, we
should count them, but this can be defeated -- if the returned data
contains a total_count key, we should use it. This also uncovered a bug
in the test suite for searching topics.

Closes #960
2018-11-23 17:08:09 +08:00
Philip May 048af7551f get_issues documentation for state (#961)
Closes #835
2018-11-20 10:13:04 +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
netsgnut 60a684c5eb Added missing params to constructor when reversed (#946)
This PR proposes adding two missing params to constructor in `.reversed`. This preserves the `headers` as well as the `list_item` once cloned.

Fixes #945.
2018-10-26 15:57:40 +08:00
Tuuu Nya 972446d5bf Fix unable to trigger RateLimitExceededException. (#943)
I found when authorized, the ratelimit error message is different from unauthorized.

so i add this.

After studying hard with my 2b colleagues @AnYeMoWang , we finally realized how tests wrote.

😸 😸 😸 😸 😸 😸 😸
2018-10-23 17:03:03 +08:00
Alice GIRARD 8ee75a282b Added support for required signatures on protected branches (#939)
Wraps the parts of the branch protection API that allows the user to require signed commits on a branch.
New methods are :
* Branch.get_required_signatures : returns true if signed commits are required
* Branch.add_required_signatures : adds the requirements for signed commits on a branch
* Branch.remove_required_signatures : removes the requirement for signed commits on a branch

It uses the API provided on this page : https://developer.github.com/v3/repos/branches/

Since this feature is in [preview](https://developer.github.com/changes/2018-02-22-protected-branches-required-signatures/) I pass the 'Accept application/vnd.github.zzzax-preview+json' header to each request.
2018-10-22 14:37:47 +08:00
Vinay Hegde 5687226b47 Ability to filter repository collaborators (#938)
## Changes
- Add `affiliation` parameter to `get_collaborators()` and use it to filter collaborators through the API
- Resolves #937


PS: Would have loved to add a simple test for this but there seems to be a problem on my end using OAuth as I'm just not able to authenticate to the API during tests.
2018-10-22 07:26:20 +08:00
Alice GIRARD 0a10d7cdf0 Mark notification as read (#932)
Wraps the parts of the notification API that allows the user to mark notifications as read.
New methods are : 
 
- Notification.mark_as_read : marks a single notification thread as read
- Repository.mark_notifications_as_read : marks all the notifications for a given repository as read
- AuthenticatedUser.mark_notifications_as_read : marks all the notifications as read

Aims to fix : https://github.com/PyGithub/PyGithub/issues/571 and simply uses the APIs described on this page : https://developer.github.com/enterprise/11.10.340/v3/activity/notifications/

A weird thing I noticed doing this is that Repository.notifications_url doesn't seem to be usable directly. I used Repository.url + "/notifications" instead.
2018-10-19 07:24:45 +08:00
AetherDeity ee9f098d91 Add a trailing slash to URL when updating or deleting a file (tests fixed) (#931)
* Add a trailing slash to URL when updating or deleting a file.

* Update test files to match new create/update/delete_file Repo methods

* Add trailing slash to get_contents() method

* update tests

* add missing slash in get_dir_contents

* add example usage

* remove dup slashes in tests

* clarify example comments
2018-10-17 08:21:17 +08:00
Wan Liuyang ade78ffb2d Fix test 2018-10-10 16:43:02 +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
Riccardo Pittau c13b43ea9c adding suspended_at property to NamedUSer (#922) 2018-10-08 21:26:38 +08:00
Michell Stuttgart 562908cb17 Improve __repr__ method of Milestone class (#921)
This commit add the title of milestone in string representation of Milestone class.
This modification improve readbility of milestone instances.

Before:
```python
>>> repo.get_milestone(number=1)
Milestone(number=1) 
```
After:
```python
>>> repo.get_milestone(number=1)
Milestone(title='Milestone Example', number=1) 
```
2018-10-08 10:19:38 +08:00
Steve Kowalik 6833245d99 Fix handling of 301 redirects (#916)
Requester.__requestRaw() was handling 301 redirects by passing the full
URL to itself, when it only expects a URL path, so parse out the path,
and pass that in. Add a test for this behaviour.

Closes: #906
2018-10-04 21:41:17 +08:00
Riccardo Pittau c411196f24 get repos missing params for authenticated users (#915)
first commit to fix issue #435
2018-10-04 15:55:11 +08:00