Commit Graph
63 Commits
Author SHA1 Message Date
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
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
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
Wan Liuyang 3f0caa4057 Sync copyright header 2018-08-19 10:47:41 +08:00
Steve Kowalik cf05688359 Use TestCase.assertRaises() (#782)
Now that we no longer support Python 2.6, we can use the assertRaises()
method of TestCase as a context manager, tiding up a large amount of
technical debt.
2018-08-15 14:54:57 +08:00
Steve Kowalik b91dee8df6 Revert "Remove NamedUser.contributions (#774)" (#865)
This reverts commit a519e4675a.

NamedUser.contributions can be populated, so we should fill in the data.

Fixes #850
2018-08-15 11:39:08 +08:00
Steve Kowalik 171cc567ae Update Branch Protection to current GitHub API
The Branch protection API has been radically changed by GitHub, add new
methods to Branch reflecting it. Branch protection methods are now
called on the Branch object itself, rather than awkwardly hanging off
the Repository object and requiring branch names to be passed in.

This adds an over-arching methods to get, edit and remove protection
entirely, as well as fine-grained methods for getting, setting and
dropping certain aspects of branch protection, as well as three new
objects to encompass querying those aspects.

This also destroys Repository.protect_branch(), the endpoint has been
removed. The old-style protection attributes on Branch have also been
removed to force users onto the new API, since they are still sent, but
no longer populated.

Fixes #586
2018-08-15 12:45:47 +10:00
Jacopo Notarstefano 29d231517d Add missing arguments to Repository.edit (#844)
As promised in https://github.com/PyGithub/PyGithub/pull/842, here's a PR to update the `edit` method so that it allows editing the newly added properties.
2018-07-15 10:32:53 +08:00
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
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
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 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
Wan Liuyang b54ccc784e Implement License API (#734)
* Implement License API

* Update copyright
2018-04-06 09:17:19 +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
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
sfdye 365a0a24d3 Apply fix_headers script to update copyright info 2018-03-17 20:06:16 +08:00
Shinichi TAMURA 0f0a7d4e68 Added target_commitish option to Repository.create_git_release() (#625)
* Added is_draft and is_prerelease property to GitRelease

* Added target_commitish option to Repository.create_git_release()

* Added test for Repository.create_git_release()

* Renamed attr of GitRelease: is_draft, is_prerelease -> draft, prerelease
2018-03-15 11:17:04 +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
Victor Granic f8b23505da Collaborator site admin (#719)
* Add admin_user property to NamedUser

* Fix type from string to bool for site_admin property

* Add a test for site_admin
2018-03-06 10:35:11 +08:00
Raihaan 0e5a1d1d53 Add maintainer can modify flag to create pull request (#703)
* Add flag for maintainer can modify when creating pull requests

* Change default to be None to let github decide the behaviour

* Update docstring

* Follow conventions from other functions
2018-02-15 10:07:26 +08:00
Iraquitan Cordeiro Filho 6cfe46b712 Add permissions field to NamedUser (#676) 2018-01-16 13:52:52 -08:00
@tmshn ba007dc8a8 Added "assignees" argument in Repository.create_issue() 2016-10-10 11:08:52 +09:00
Jannis Gebauer 0799753530 adds support for content dirs 2016-09-15 14:22:22 +02:00
Jannis Gebauer 8571d87c77 adds a nicer __repr__ 2016-09-08 10:25:48 +02:00
Jannis Gebauer 446313ea81 Merge branch 'master' of https://github.com/enix223/PyGithub into enix223-master 2016-07-18 17:15:19 +02:00
Peter Buckley cb0cf0a680 update doc url everywhere (#420) 2016-07-12 16:38:02 -04:00
Enix Yu 5b7f0bb6a8 fix python3 compatibility issue for using json/base64 2016-01-16 16:11:34 +08:00
Enix Yu 00777dbff5 fix python3 compatability error in test case 2016-01-15 12:37:32 +08:00
Enix Yu 4aaeb9e73b Add repo content create/update/delete testcase 2016-01-15 12:03:26 +08:00
Jimmy Zelinskie 65360b0d30 fix protect branch tests 2016-01-12 22:55:33 -05:00
Kyle Hornberg 737f0c3ebe Add branch protection endpoint 2016-01-07 08:13:20 -06:00
Enix Yu b83ffbf893 add content file create/update/delete api 2015-12-23 10:35:09 +08:00
Dan Vanderkam d31742a719 Add repo.get_stargazers_with_dates() 2015-10-14 15:19:39 -04:00
Christopher Wilcox 3f65a123fb Add test for #339 fix 2015-09-16 15:43:15 -07:00
Uriel Corfa 626d29c938 Add support to create Repository objects lazily in MainClass.
This lets users do the following without issuing an unnecessary request:

issues_of_my_repository = g.get_repo('PyGithub/PyGithub').get_issues()

Since the GithubObject layer handles laziness transparently, lazy
loading is enabled by default, and can be disabled via the `lazy`
kwarg. This does not affect any test except tests that pertain to
caching or laziness itself.
2015-03-26 20:56:27 -07: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 3ff7e4843e Publish version 1.21.0 2013-11-17 14:07:01 -08:00
Vincent Jacques ebe6f01151 Fix tests for Python 2.5 and 2.6 2013-11-17 10:19:40 -08:00
Vincent Jacques c6671c6466 Finish .../stats/... (#203) 2013-11-17 10:16:59 -08:00
Vincent Jacques a4910ac922 First step of implementation of Repository.get_stats_xxx (#203) 2013-11-10 18:09:48 -08:00
Vincent Jacques 6c37e68901 Add 'author' to 'Repository.get_commits' (#204) 2013-11-10 16:52:46 -08:00
Vincent Jacques 51fa637514 Remove tests for deleted methods! 2013-10-20 19:17:38 -07:00
Vincent Jacques 5093cc255a Fix public/private in Repository.edit (#199) 2013-10-20 19:03:35 -07:00
Vincent Jacques 0a2df45155 pep8 2013-08-21 16:18:33 +02:00
Vincent Jacques 67a7daa22b Improve coverage for #187 2013-08-19 23:35:02 +02:00
Vincent Jacques 06a3d87098 Change source file header format 2013-07-13 19:03:53 +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 1e99e7d5b2 Reduce 2to3 differences 2013-03-21 22:05:37 +01:00