Commit Graph
945 Commits
Author SHA1 Message Date
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
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
Brian J. Murrell a18eeb3a05 Line comments are not posted in create_review() (#909)
When create_review() is called with comments in the comments argument,
they are not actually posted in the API call.
2018-09-26 09:55:33 +08:00
Wan Liuyang 598bee8193 Fix totalCount for empty response, closes #905 2018-09-18 16:34:38 +08:00
Jacopo Notarstefano 7286eec0e0 Fix Repository.edit (#904)
Allows to pass falsy values to the new arguments introduced in #844.

Closes #903
2018-09-16 20:00:20 +08:00
Wan Liuyang d92389be07 Restore RateLimit.rate attribute, raise deprecation warning instead 2018-09-12 14:53:44 +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 55b8fb4ca1 Add missing backticks to Branch Protection docs (#889)
The docstrings for the Branch Protection methods that take classes as
arguments were missing backticks for the class name, add them so the
docs contain proper links.
2018-08-28 16:10:22 +08:00
Steve Kowalik eb80564b01 Implement Organization.invite_user (#880)
Utilize the API preview for the organization invite system to allow
organization owners to invite outside colloborators either via passing
in the user directly, or their email address.
    
Fixes #851
2018-08-28 14:29:23 +08:00
Steve Kowalik ef16702a0d Add support for required approving review count (#888)
The GitHub API currently has a beta extension to the Branch Protection
API that allows inspection and setting of the number of required
approving reviews required for a PR to be merged. Add support for it.
2018-08-28 13:34:34 +08:00
Steve Kowalik 08fa797f1d Improve Branch Protection function docstrings (#887)
The docstrings for the edit methods for portions of Branch Protection
did not document their arguments and types, add them.
2018-08-28 13:12:33 +08:00
Steve Kowalik 7b099c9800 Implement Repository.get_collaborator_permission (#881)
Add a method to Repository, collaborator_permission that allows users
with push access to repositories to query the permission level of
collaborators.

Fixes #722
2018-08-27 13:23:03 +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
Aaron L. Levine 7ac2a2ac97 Adding new attributes to IssueEvent (#857)
See Issue #855 

The class [IssueEvent](https://github.com/PyGithub/PyGithub/blob/master/github/IssueEvent.py) is missing a large number of attributes documented in the [API](https://developer.github.com/v3/issues/events/).

This is also commented about in #653 to a degree

27 of the tests 27 known event types have tests.

**Currently Tested using Issue #30**            
- [x] subscribed
- [x] assigned
- [x] referenced               
- [x] closed                   
- [x] labeled                  

**Currently Tested using Issue/PR #538**
- [x] merged
- [x] mentioned
- [x] review_requested

**Currently Tested using Issue/PR #857**
- [x] reopened
- [x] unassigned
- [x] unlabeled
- [x] renamed
- [x] base_ref_changed
- [x] head_ref_deleted 
- [x] head_ref_restored
- [x] milestoned
- [x] demilestoned
- [x] locked
- [x] unlocked
- [x] review_dismissed
- [x] review_request_removed
- [x] marked_as_duplicate
- [x] unmarked_as_duplicate
- [x] added_to_project       
- [x] moved_columns_in_project
- [x] removed_from_project
- [x] converted_note_to_issue - Note: this event is tied into Issue #866 

This PR is now ready to be merged
2018-08-25 00:01:29 +08:00
Wan Liuyang de6b713b05 Force absolute import, fixes #314 2018-08-24 15:08:18 +08:00
Steve Kowalik 3cc0742fbe Switch remaining try/except tests to assertRaises (#879)
The BadAttributes and Enterprise tests made use of try/except to check
details of raised exceptions, so switch to using assertRaises, much like
the github.GithubException tests[1].

1: cf05688359
2018-08-24 10:52:53 +08:00
Wan Liuyang f3abadae08 Fix Organization display name 2018-08-21 15:29:36 +08:00
Wan Liuyang 7c73d8de4e Fix Organization display name 2018-08-21 15:25:56 +08:00
Wan Liuyang ae5cdb285e Refactor common header constants and custom media type 2018-08-21 15:01:23 +08:00
Steve Kowalik ebcd3a52e3 Remove custom swamp-thing-preview header (#873)
The Repository Invitation API graduated on July 17, 2017, so the custom
Accept header is no longer required.
2018-08-21 13:49:04 +08:00
Steve Kowalik 49db6f8771 Remove Repository.get_protected_branch (#871)
With both the custom Accept header and the new code that supports the
new Branch Protection API, Repository.get_protected_branch() is no
longer required, and it also was never tested, so remove it.
2018-08-20 17:25:32 +08:00
Wan Liuyang 310d0733ee Fix a few docs error 2018-08-20 16:07:36 +08:00