Since the headers that led to an exception are also useful, firstly pass
them into the constructor, and then export them in a property. Test one
specific use case to make sure of coverage.
Fixes#1814
requests has a default connections pool of 10. Creating multiple threads
will consume from that same pool, since the underlying implementation of
the requests pool is a singletown.
Let's make the pool_size configurable, so clients can set the proper
number for their use case when running multiple threads.
Signed-off-by: Amador Pahim <apahim@redhat.com>
The API preview flag for both MainClass and Requester was the last
hard-coded custom header, and it seems to not be relevant since
mid-2015. Remove it, if any users are using it, they shouldn't be. Its
code path was also entirely untested.
To stop skipping logging tests on Python 3, refactor them to mock out
the logger and check arguments directly, rather than naively comparing
strings. Allow a logger to be injected into Requester for this.
Currently, we were checking for an uppercase header if GitHub was
refusing our authentication because we didn't provide a token. Requests
returns headers with all lowercase. Fix the const, and add a test for
good measure.
Fixes#1273
There are a number of call sites that would behave differently depending
on Python 2 or 3. A fair amount of them are left over from Python 3.2 or
Python 2.6 were the current versions, and it was much harder to write
compatible code for both versions. Happily, that is now in the past, so
refactor some of them out.
Clean up a few errors I missed, ignore another, and configure flake8 using
a config file to ignore certain errors. The next step would be to remove
the F* ignores.
With the Python 2.7 deadline fast approaching, modernize the codebase
making use of the modernize module to switch to using six, as well as
other upcoming features, such as absolute imports . Stop using 2to3
for Travis, yay!
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#757Closes#860
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.
😸😸😸😸😸😸😸
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
* 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
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~~
* 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