Merge branch 'master' into patch-1
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Kenneth Reitz · committed by GitHub · parents 45c2e67, d79024f · Browse files · 20 files·+62 added−51 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
20 files+62 added−51 removed
- tests:+5 added−5 removed
- other:+57 added−46 removed
Provenance
- Commit
9bc49b5- Tree
298c2c8- Author
Kenneth Reitz <me@kennethreitz.org>- Committer
GitHub <noreply@github.com>- Parent 1
45c2e67- Parent 2
d79024f
20 files changed+62 added−51 removed
modified:docs/_templates/sidebarintro.html+2 added-2 removed
69 unmodified lines7071727374747576767778798051 unmodified lines69 unmodified lines <li><a href="http://docs.python-requests.org/en/latest/community/recommended/">Recommended Packages and Extensions</a></li>
<p></p>
<li><a href="https://github.com/requests/requests">Requests @ GitHub</a></li> <li><a href="https://github.com/psf/requests">Requests @ GitHub</a></li> <li><a href="https://pypi.org/project/requests/">Requests @ PyPI</a></li> <li><a href="https://github.com/requests/requests/issues">Issue Tracker</a></li> <li><a href="https://github.com/psf/requests/issues">Issue Tracker</a></li> <li><a href="http://docs.python-requests.org/en/latest/community/updates/#software-updates">Release History</a></li></ul>
51 unmodified linesmodified:docs/community/support.rst+1 added-1 removed
27 unmodified lines28 -------------29 30 If you notice some unexpected behaviour in Requests, or want to see support31 for a new feature,32-`file an issue on GitHub <https://github.com/requests/requests/issues>`_.32+`file an issue on GitHub <https://github.com/psf/requests/issues>`_.33 34 35 E-mail36 ------18 unmodified linesmodified:docs/community/updates.rst+1 added-1 removed
12 unmodified lines13 GitHub14 ------15 16 The best way to track the development of Requests is through17-`the GitHub repo <https://github.com/requests/requests>`_.17+`the GitHub repo <https://github.com/psf/requests>`_.18 19 Twitter20 -------21 10 unmodified linesmodified:docs/dev/contributing.rst+9 added-2 removed
128 unmodified lines129 # Aligned with opening delimiter.130 foo = long_function_name(var_one, var_two,131 var_three, var_four)132 133-No. Just don't. Please.133+No. Just don't. Please. This is much better::134 135+ foo = long_function_name(136+ var_one,137+ var_two,138+ var_three,139+ var_four,140+ )141+142 Docstrings are to follow the following syntaxes::143 144 def the_earth_is_flat():145 """NASA divided up the seas into thirty-three degrees."""50 unmodified lines196 through the `GitHub issues`_, **both open and closed**, to confirm that the bug197 hasn't been reported before. Duplicate bug reports are a huge drain on the time198 of other contributors, and should be avoided as much as possible.199 193-.. _GitHub issues: https://github.com/requests/requests/issues200+.. _GitHub issues: https://github.com/psf/requests/issues201 202 203 Feature Requests204 ----------------12 unmodified linesmodified:docs/dev/todo.rst+2 added-2 removed
6 unmodified lines7 8 #. Check for open issues or open a fresh issue to start a discussion around a bug.9 There is a Contributor Friendly tag for issues that should be ideal for people who are not very10 familiar with the codebase yet.11-#. Fork `the repository <https://github.com/requests/requests>`_ on GitHub and start making your11+#. Fork `the repository <https://github.com/psf/requests>`_ on GitHub and start making your12 changes to a new branch.13 #. Write a test which shows that the bug was fixed.14 #. Send a pull request and bug the maintainer until it gets merged and published. :)15- Make sure to add yourself to `AUTHORS <https://github.com/requests/requests/blob/master/AUTHORS.rst>`_.15+ Make sure to add yourself to `AUTHORS <https://github.com/psf/requests/blob/master/AUTHORS.rst>`_.16 17 Feature Freeze18 --------------19 45 unmodified linesmodified:docs/user/advanced.rst+7 added-7 removed
191 unmodified lines192 When you are using the prepared request flow, keep in mind that it does not take into account the environment.193 This can cause problems if you are using environment variables to change the behaviour of requests.194 For example: Self-signed SSL certificates specified in ``REQUESTS_CA_BUNDLE`` will not be taken into account.195 As a result an ``SSL: CERTIFICATE_VERIFY_FAILED`` is thrown.196-You can get around this behaviour by explicity merging the environment settings into your session::196+You can get around this behaviour by explicitly merging the environment settings into your session::197 198 from requests import Request, Session199 200 s = Session()98 unmodified lines299 immediately. You can override this behaviour and defer downloading the response300 body until you access the :attr:`Response.content <requests.Response.content>`301 attribute with the ``stream`` parameter::302 303- tarball_url = 'https://github.com/requests/requests/tarball/master'303+ tarball_url = 'https://github.com/psf/requests/tarball/master'304 r = requests.get(tarball_url, stream=True)305 306 At this point only the response headers have been downloaded and the connection307 remains open, hence allowing us to make content retrieval conditional::371 unmodified lines679 from GitHub. Suppose we wanted commit ``a050faf`` on Requests. We would get it680 like so::681 682 >>> import requests683- >>> r = requests.get('https://api.github.com/repos/requests/requests/git/commits/a050faf084662f3a352dd1a941f2c7c9f886d4ad')683+ >>> r = requests.get('https://api.github.com/repos/psf/requests/git/commits/a050faf084662f3a352dd1a941f2c7c9f886d4ad')684 685 We should confirm that GitHub responded correctly. If it has, we want to work686 out what type of content it is. Do this like so::687 46 unmodified lines734 we should probably avoid making ham-handed POSTS to it. Instead, let's play735 with the Issues feature of GitHub.736 737 This documentation was added in response to738-`Issue #482 <https://github.com/requests/requests/issues/482>`_. Given that738+`Issue #482 <https://github.com/psf/requests/issues/482>`_. Given that739 this issue already exists, we will use it as an example. Let's start by getting it.740 741 ::742 743- >>> r = requests.get('https://api.github.com/repos/requests/requests/issues/482')743+ >>> r = requests.get('https://api.github.com/repos/psf/requests/issues/482')744 >>> r.status_code745 200746 747 >>> issue = json.loads(r.text)34 unmodified lines782 783 ::784 785 >>> body = json.dumps({u"body": u"Sounds great! I'll get right on it!"})786- >>> url = u"https://api.github.com/repos/requests/requests/issues/482/comments"786+ >>> url = u"https://api.github.com/repos/psf/requests/issues/482/comments"787 788 >>> r = requests.post(url=url, data=body)789 >>> r.status_code790 40425 unmodified lines816 >>> print(content[u"id"])817 5804413818 819 >>> body = json.dumps({u"body": u"Sounds great! I'll get right on it once I feed my cat."})820- >>> url = u"https://api.github.com/repos/requests/requests/issues/comments/5804413"820+ >>> url = u"https://api.github.com/repos/psf/requests/issues/comments/5804413"821 822 >>> r = requests.patch(url=url, data=body, auth=auth)823 >>> r.status_code824 200208 unmodified linesmodified:docs/user/install.rst+4 added-4 removed
23 unmodified lines24 Get the Source Code25 -------------------26 27 Requests is actively developed on GitHub, where the code is28-`always available <https://github.com/requests/requests>`_.28+`always available <https://github.com/psf/requests>`_.29 30 You can either clone the public repository::31 32- $ git clone git://github.com/requests/requests.git32+ $ git clone git://github.com/psf/requests.git33 34-Or, download the `tarball <https://github.com/requests/requests/tarball/master>`_::34+Or, download the `tarball <https://github.com/psf/requests/tarball/master>`_::35 36- $ curl -OL https://github.com/requests/requests/tarball/master36+ $ curl -OL https://github.com/psf/requests/tarball/master37 # optionally, zipball is also available (for Windows users).38 39 Once you have a copy of the source, you can embed it in your own Python40 package, or install it into your site-packages easily::3 unmodified linesmodified:docs/index.rst+2 added-2 removed
15 unmodified lines16 17 .. image:: https://img.shields.io/pypi/pyversions/requests.svg18 :target: https://pypi.org/project/requests/19 20-.. image:: https://codecov.io/github/requests/requests/coverage.svg?branch=master21- :target: https://codecov.io/github/requests/requests20+.. image:: https://codecov.io/github/psf/requests/coverage.svg?branch=master21+ :target: https://codecov.io/github/psf/requests22 :alt: codecov.io23 24 .. image:: https://img.shields.io/badge/Say%20Thanks!-🦉-1EAEDB.svg25 :target: https://saythanks.io/to/kennethreitz149 unmodified linesmodified:requests/api.py+4 added-2 removed
14 unmodified lines15 16 def request(method, url, **kwargs):17 """Constructs and sends a :class:`Request <Request>`.18 19- :param method: method for the new :class:`Request` object.19+ :param method: method for the new :class:`Request` object: ``GET``, ``OPTIONS``, ``HEAD``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``.20 :param url: URL for the new :class:`Request` object.21 :param params: (optional) Dictionary, list of tuples or bytes to send22 in the query string for the :class:`Request`.23 :param data: (optional) Dictionary, list of tuples, bytes, or file-like67 unmodified lines91 def head(url, **kwargs):92 r"""Sends a HEAD request.93 94 :param url: URL for the new :class:`Request` object.95- :param \*\*kwargs: Optional arguments that ``request`` takes.95+ :param \*\*kwargs: Optional arguments that ``request`` takes. If96+ `allow_redirects` is not provided, it will be set to `False` (as97+ opposed to the default :meth:`request` behavior).98 :return: :class:`Response <Response>` object99 :rtype: requests.Response100 """101 59 unmodified linesmodified:requests/auth.py+1 added-1 removed
237 unmodified lines238 :rtype: requests.Response239 """240 241 # If response is not 4xx, do not auth242- # See https://github.com/requests/requests/issues/3772242+ # See https://github.com/psf/requests/issues/3772243 if not 400 <= r.status_code < 500:244 self._thread_local.num_401_calls = 1245 return r246 59 unmodified linesmodified:requests/models.py+2 added-2 removed
10 unmodified lines11 import sys12 13 # Import encoding now, to avoid implicit import later.14 # Implicit import within threads may cause LookupError when standard library is in a ZIP,15-# such as in Embedded Python. See https://github.com/requests/requests/issues/3578.15+# such as in Embedded Python. See https://github.com/psf/requests/issues/3578.16 import encodings.idna17 18 from urllib3.fields import RequestField19 from urllib3.filepost import encode_multipart_formdata337 unmodified lines357 #: Accept objects that have string representations.358 #: We're unable to blindly call unicode/str functions359 #: as this will include the bytestring indicator (b'')360 #: on python 3.x.361- #: https://github.com/requests/requests/pull/2238361+ #: https://github.com/psf/requests/pull/2238362 if isinstance(url, bytes):363 url = url.decode('utf8')364 else:365 url = unicode(url) if is_py2 else str(url)588 unmodified linesmodified:requests/sessions.py+2 added-2 removed
190 unmodified lines191 prepared_request.url = to_native_string(url)192 193 self.rebuild_method(prepared_request, resp)194 195- # https://github.com/requests/requests/issues/1084195+ # https://github.com/psf/requests/issues/1084196 if resp.status_code not in (codes.temporary_redirect, codes.permanent_redirect):197- # https://github.com/requests/requests/issues/3490197+ # https://github.com/psf/requests/issues/3490198 purged_headers = ('Content-Length', 'Content-Type', 'Transfer-Encoding')199 for header in purged_headers:200 prepared_request.headers.pop(header, None)201 prepared_request.body = None569 unmodified linesmodified:requests/utils.py+1 added-1 removed
177 unmodified lines178 loc = os.path.expanduser('~/{}'.format(f))179 except KeyError:180 # os.path.expanduser can fail when $HOME is undefined and181 # getpwuid fails. See https://bugs.python.org/issue20164 &182- # https://github.com/requests/requests/issues/1846182+ # https://github.com/psf/requests/issues/1846183 return184 185 if os.path.exists(loc):186 netrc_path = loc791 unmodified linesmodified:tests/test_lowlevel.py+2 added-2 removed
26 unmodified lines27 def test_digestauth_401_count_reset_on_redirect():28 """Ensure we correctly reset num_401_calls after a successful digest auth,29 followed by a 302 redirect to another digest auth prompt.30 31- See https://github.com/requests/requests/issues/1979.31+ See https://github.com/psf/requests/issues/1979.32 """33 text_401 = (b'HTTP/1.1 401 UNAUTHORIZED\r\n'34 b'Content-Length: 0\r\n'35 b'WWW-Authenticate: Digest nonce="6bf5d6e4da1ce66918800195d6b9130d"'101 unmodified lines137 138 def test_digestauth_only_on_4xx():139 """Ensure we only send digestauth on 4xx challenges.140 141- See https://github.com/requests/requests/issues/3772.141+ See https://github.com/psf/requests/issues/3772.142 """143 text_200_chal = (b'HTTP/1.1 200 OK\r\n'144 b'Content-Length: 0\r\n'145 b'WWW-Authenticate: Digest nonce="6bf5d6e4da1ce66918800195d6b9130d"'164 unmodified linesmodified:tests/test_requests.py+2 added-2 removed
464 unmodified lines465 466 @pytest.mark.parametrize('key', ('User-agent', 'user-agent'))467 def test_user_agent_transfers(self, httpbin, key):468 469- heads = {key: 'Mozilla/5.0 (github.com/requests/requests)'}469+ heads = {key: 'Mozilla/5.0 (github.com/psf/requests)'}470 471 r = requests.get(httpbin('user-agent'), headers=heads)472 assert heads[key] in r.text473 1737 unmodified lines2211 except ConnectTimeout:2212 pass2213 2214 def test_encoded_methods(self, httpbin):2215- """See: https://github.com/requests/requests/issues/2316"""2215+ """See: https://github.com/psf/requests/issues/2316"""2216 r = requests.request(b'GET', httpbin('get'))2217 assert r.ok2218 2219 308 unmodified linesmodified:tests/test_utils.py+1 added-1 removed
395 unmodified lines396 'http://example.com/fiz?buz=%25ppicture',397 ),398 ))399 def test_requote_uri_with_unquoted_percents(uri, expected):400- """See: https://github.com/requests/requests/issues/2356"""400+ """See: https://github.com/psf/requests/issues/2356"""401 assert requote_uri(uri) == expected402 403 404 @pytest.mark.parametrize(378 unmodified linesmodified:.gitignore+1 added
12 unmodified lines13 *.pyc14 *.swp15 *.egg16 env/17+.eggs/18 19 .workon20 21 t.py5 unmodified linesmodified:AUTHORS.rst+1 added
187 unmodified lines188 - Demetrios Bairaktaris (`@DemetriosBairaktaris <https://github.com/demetriosbairaktaris>`_)189 - Darren Dormer (`@ddormer <https://github.com/ddormer>`_)190 - Rajiv Mayani (`@mayani <https://github.com/mayani>`_)191 - Antti Kaihola (`@akaihola <https://github.com/akaihola>`_)192+- "Dull Bananas" <dull.bananas0@gmail.com> (`@dullbananas <https://github.com/dullbananas>`_)modified:HISTORY.md+10 added-10 removed
547 unmodified lines548 status code registry.549 550 **Bugfixes**551 552-- For file-like objects that are not seeked to the very beginning, we552+- For file-like objects that are not sought to the very beginning, we553 now send the content length for the number of bytes we will actually554 read, rather than the total size of the file, allowing partial file555 uploads.556 - When uploading file-like objects, if they are empty or have no235 unmodified lines792 793 - Unicode URL improvements for Python 2.794 - Re-order JSON param for backwards compat.795 - Automatically defrag authentication schemes from host/pass URIs.796- ([\#2249](https://github.com/requests/requests/issues/2249))796+ ([\#2249](https://github.com/psf/requests/issues/2249))797 798 2.4.2 (2014-10-05)799 ------------------800 801 **Improvements**802 803 - FINALLY! Add json parameter for uploads!804- ([\#2258](https://github.com/requests/requests/pull/2258))804+ ([\#2258](https://github.com/psf/requests/pull/2258))805 - Support for bytestring URLs on Python 3.x806- ([\#2238](https://github.com/requests/requests/pull/2238))806+ ([\#2238](https://github.com/psf/requests/pull/2238))807 808 **Bugfixes**809 810 - Avoid getting stuck in a loop811- ([\#2244](https://github.com/requests/requests/pull/2244))811+ ([\#2244](https://github.com/psf/requests/pull/2244))812 - Multiple calls to iter\* fail with unhelpful error.813- ([\#2240](https://github.com/requests/requests/issues/2240),814- [\#2241](https://github.com/requests/requests/issues/2241))813+ ([\#2240](https://github.com/psf/requests/issues/2240),814+ [\#2241](https://github.com/psf/requests/issues/2241))815 816 **Documentation**817 818 - Correct redirection introduction819- ([\#2245](https://github.com/requests/requests/pull/2245/))819+ ([\#2245](https://github.com/psf/requests/pull/2245/))820 - Added example of how to send multiple files in one request.821- ([\#2227](https://github.com/requests/requests/pull/2227/))821+ ([\#2227](https://github.com/psf/requests/pull/2227/))822 - Clarify how to pass a custom set of CAs823- ([\#2248](https://github.com/requests/requests/pull/2248/))823+ ([\#2248](https://github.com/psf/requests/pull/2248/))824 825 2.4.1 (2014-09-09)826 ------------------827 823 unmodified linesmodified:README.md+7 added-7 removed
2 unmodified lines3 4 [](https://pypi.org/project/requests/)5 [](https://pypi.org/project/requests/)6 [](https://pypi.org/project/requests/)7-[](https://codecov.io/github/requests/requests)8-[](https://github.com/requests/requests/graphs/contributors)7+[](https://codecov.io/github/psf/requests)8+[](https://github.com/psf/requests/graphs/contributors)9 [](https://saythanks.io/to/kennethreitz)10 11 Requests is the only *Non-GMO* HTTP library for Python, safe for human12 consumption.18 unmodified lines31 ```32 33 See [the similar code, sans Requests](https://gist.github.com/973705).34 35-[](http://docs.python-requests.org/)35+[](http://docs.python-requests.org/)36 37 Requests allows you to send *organic, grass-fed* HTTP/1.1 requests,38 without the need for manual labor. There's no need to manually add query39 strings to your URLs, or to form-encode your POST data. Keep-alive and40 HTTP connection pooling are 100% automatic, thanks to41 [urllib3](https://github.com/shazow/urllib3).42 43 Besides, all the cool kids are doing it. Requests is one of the most44-downloaded Python packages of all time, pulling in over 11,000,00044+downloaded Python packages of all time, pulling in over 50,000,00045 downloads every month. You don't want to be left out!46 47 Feature Support48 ---------------43 unmodified lines92 93 1. Become more familiar with the project by reading our [Contributor's Guide](http://docs.python-requests.org/en/latest/dev/contributing/) and our [development philosophy](http://docs.python-requests.org/en/latest/dev/philosophy/).94 2. Check for open issues or open a fresh issue to start a discussion95 around a feature idea or a bug. There is a [Contributor96- Friendly](https://github.com/requests/requests/issues?direction=desc&labels=Contributor+Friendly&page=1&sort=updated&state=open)96+ Friendly](https://github.com/psf/requests/issues?direction=desc&labels=Contributor+Friendly&page=1&sort=updated&state=open)97 tag for issues that should be ideal for people who are not very98 familiar with the codebase yet.99-3. Fork [the repository](https://github.com/requests/requests) on99+3. Fork [the repository](https://github.com/psf/requests) on100 GitHub to start making your changes to the **master** branch (or101 branch off of it).102 4. Write a test which shows that the bug was fixed or that the feature103 works as expected.104 5. Send a [pull request](https://help.github.com/en/articles/creating-a-pull-request-from-a-fork) and bug the maintainer until it gets merged and105 published. :) Make sure to add yourself to106- [AUTHORS](https://github.com/requests/requests/blob/master/AUTHORS.rst).106+ [AUTHORS](https://github.com/psf/requests/blob/master/AUTHORS.rst).107