Commit Graph
142 Commits
Author SHA1 Message Date
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
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
Shubham Singh b4d895eddd Adding migration api wrapper (#899)
Closes #818
2018-12-21 12:01:01 +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
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
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
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
Dylan 43d325a552 Add allow_redirects option (#858)
Fixes #830

Latest release v1.40 has broken get_archive_link
https://github.com/PyGithub/PyGithub/issues/830
2018-08-19 10:41:32 +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
Maarten Fonville 23395f5f14 Fix Content-Length invalid headers exception (#787) 2018-05-17 14:05:32 +08:00
Mike Miller 85a9124b09 Add ability to skip SSL verify from requests (#758) 2018-04-26 14:46:44 +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
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
R1kk3r cbfe8d0f62 Remove the default "null" input send during GET request (#691)
* Remove the default "null" input send during GET request

* Remove the 'null' value from all tests
2018-01-31 16:16:11 -08:00
Simon 6bc804dc15 ♻️ Fix all pep8 coding conventions 2018-01-16 13:41:02 -08:00
Hugo 6735be4933 Drop support for EOL Python 2.5-2.6 and 3.2-3.3 (#674) 2017-12-20 22:52:00 -08:00
Chris McBride 52449649a4 Add ability to access github Release Asset API. (#525)
* Add ability to access github Release Asset API.
See: https://developer.github.com/v3/repos/releases
2017-11-27 10:01:03 -06:00
Jimmy Zelinskie aca37dbb14 Merge pull request #462 from geex-arts/fix-rate-limit-exception
Fix diffrerent case
2016-09-28 21:19:16 -04:00
Denis K fcf6cfb50a Fix diffrerent case 2016-09-25 22:31:20 +03:00
Denis K 073bb442f6 Fix status check 2016-09-16 20:44:01 +03:00
Jared K. Smith 464259da91 Add missing space 2016-08-30 06:17:22 -04:00
Jared K. Smith d015154c98 Properly handle HTTP Proxy authentication with Python 3 2016-08-29 13:19:18 -04:00
Peter Buckley cb0cf0a680 update doc url everywhere (#420) 2016-07-12 16:38:02 -04:00
Mathieu Mitchell c29f5335cc Follow redirects in the case of a 301 status code 2016-05-27 09:25:32 -04:00
Brian Eugley 9be7506f15 code improvement 2015-04-15 15:50:30 -04:00
Brian Eugley f035591d70 Get proxy info from http_proxy first, HTTP_PROXY second 2015-04-15 15:23:17 -04:00
Brian Eugley 7c79c1b80b Connect through a proxy with authentication 2015-04-15 13:56:46 -04:00
Jimmy Zelinskie 5e34bfeb2e Merge pull request #294 from dpocock/dpocock-accept
Allow access to preview versions of the server-side API
2015-03-18 15:16:45 -04:00
Daniel Pocock cd8fe788e4 Allow access to preview versions of the server-side API 2015-02-03 11:56:13 +01:00
Jimmy Zelinskie 33b9ce9658 Remove URL scheme assertion.
This part of the URL isn't used and can be wrong due to bugs in GitHub
Enterprise.
2014-12-15 15:00:40 -05: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 580528876a Acknowledge some lack of test coverage 2014-05-04 12:18:00 -07:00
Vincent Jacques 4dfc3dec5f Merge branch 'develop' 2013-12-23 19:40:04 -08:00
Vincent Jacques f74c95a944 Integrate #220 (fix tests and pep8) 2013-12-23 19:38:39 -08:00
Vincent Jacques 6767e75c52 Fix #216: handle 'Link' header
Headers with capitals are returned by http.client (replacing httplib in Python 3)
2013-12-23 19:25:11 -08:00
Cameron White 36352598ae Added onetime_password to create_authorization
github.AuthenticatedUser.create_authorization has been modified to
support two-factor authentication. When two-factor authentication
is enabled create_authorization will throw an TwoFactorException.
The onetime password can be then be passed to create_authorization
on a subsequent call.
2013-12-19 04:05:26 -08:00
Vincent Jacques a9b9765254 Acknowledge branch coverage lack 2013-09-06 11:17:09 +02:00
Vincent Jacques c819580ce8 Get status of Github API (#188) 2013-09-06 11:01:33 +02:00
Vincent Jacques f2feb81dae Add default parameters to greatly reduce code redoundancy 2013-09-06 11:01:32 +02:00
Vincent Jacques 1d0ba7ef64 Don't assume there is a 'message' field in case of error 2013-09-05 18:23:47 +02:00
Vincent Jacques fb6980ce36 Move the DEBUG_ON_RESPONSE call to Requester.__requestEncode 2013-08-23 19:05:53 +02:00
Vincent Jacques e084b51381 #193: Fix test coverage 2013-08-23 14:51:34 +02:00
Vincent Jacques 64cf539c83 #193: Add a param to Requester.requestXxx for request headers 2013-08-23 11:31:01 +02:00
Vincent Jacques 03d7fb012e #193: Add remarks 2013-08-23 11:15:17 +02:00
Vincent Jacques bae0a37d18 #193: Don't use a try-except for a usual execution flow in GithubObject.update
(and factorize assignment of headers in _storeAndUseAttributes,
as done for rawData)
2013-08-23 11:10:35 +02:00