diff --git a/.gitignore b/.gitignore index cd0c32e9..0f175468 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ requests.egg-info/ *.swp *.egg env/ +.eggs/ .workon diff --git a/AUTHORS.rst b/AUTHORS.rst index f0ee696b..22147342 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -189,3 +189,4 @@ Patches and Suggestions - Darren Dormer (`@ddormer `_) - Rajiv Mayani (`@mayani `_) - Antti Kaihola (`@akaihola `_) +- "Dull Bananas" (`@dullbananas `_) diff --git a/HISTORY.md b/HISTORY.md index 0b1f9f5e..62c254f5 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -549,7 +549,7 @@ Or, even better: **Bugfixes** -- For file-like objects that are not seeked to the very beginning, we +- For file-like objects that are not sought to the very beginning, we now send the content length for the number of bytes we will actually read, rather than the total size of the file, allowing partial file uploads. @@ -793,7 +793,7 @@ documentation](http://docs.python-requests.org/en/latest/community/release-proce - Unicode URL improvements for Python 2. - Re-order JSON param for backwards compat. - Automatically defrag authentication schemes from host/pass URIs. - ([\#2249](https://github.com/requests/requests/issues/2249)) + ([\#2249](https://github.com/psf/requests/issues/2249)) 2.4.2 (2014-10-05) ------------------ @@ -801,26 +801,26 @@ documentation](http://docs.python-requests.org/en/latest/community/release-proce **Improvements** - FINALLY! Add json parameter for uploads! - ([\#2258](https://github.com/requests/requests/pull/2258)) + ([\#2258](https://github.com/psf/requests/pull/2258)) - Support for bytestring URLs on Python 3.x - ([\#2238](https://github.com/requests/requests/pull/2238)) + ([\#2238](https://github.com/psf/requests/pull/2238)) **Bugfixes** - Avoid getting stuck in a loop - ([\#2244](https://github.com/requests/requests/pull/2244)) + ([\#2244](https://github.com/psf/requests/pull/2244)) - Multiple calls to iter\* fail with unhelpful error. - ([\#2240](https://github.com/requests/requests/issues/2240), - [\#2241](https://github.com/requests/requests/issues/2241)) + ([\#2240](https://github.com/psf/requests/issues/2240), + [\#2241](https://github.com/psf/requests/issues/2241)) **Documentation** - Correct redirection introduction - ([\#2245](https://github.com/requests/requests/pull/2245/)) + ([\#2245](https://github.com/psf/requests/pull/2245/)) - Added example of how to send multiple files in one request. - ([\#2227](https://github.com/requests/requests/pull/2227/)) + ([\#2227](https://github.com/psf/requests/pull/2227/)) - Clarify how to pass a custom set of CAs - ([\#2248](https://github.com/requests/requests/pull/2248/)) + ([\#2248](https://github.com/psf/requests/pull/2248/)) 2.4.1 (2014-09-09) ------------------ diff --git a/README.md b/README.md index 41e92667..f0465de7 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ Requests: HTTP for Humans™ [![image](https://img.shields.io/pypi/v/requests.svg)](https://pypi.org/project/requests/) [![image](https://img.shields.io/pypi/l/requests.svg)](https://pypi.org/project/requests/) [![image](https://img.shields.io/pypi/pyversions/requests.svg)](https://pypi.org/project/requests/) -[![codecov.io](https://codecov.io/github/requests/requests/coverage.svg?branch=master)](https://codecov.io/github/requests/requests) -[![image](https://img.shields.io/github/contributors/requests/requests.svg)](https://github.com/requests/requests/graphs/contributors) +[![codecov.io](https://codecov.io/github/psf/requests/coverage.svg?branch=master)](https://codecov.io/github/psf/requests) +[![image](https://img.shields.io/github/contributors/psf/requests.svg)](https://github.com/psf/requests/graphs/contributors) [![image](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/kennethreitz) Requests is the only *Non-GMO* HTTP library for Python, safe for human @@ -32,7 +32,7 @@ u'{"type":"User"...' See [the similar code, sans Requests](https://gist.github.com/973705). -[![image](https://raw.githubusercontent.com/requests/requests/master/docs/_static/requests-logo-small.png)](http://docs.python-requests.org/) +[![image](https://raw.githubusercontent.com/psf/requests/master/docs/_static/requests-logo-small.png)](http://docs.python-requests.org/) Requests allows you to send *organic, grass-fed* HTTP/1.1 requests, without the need for manual labor. There's no need to manually add query @@ -41,7 +41,7 @@ HTTP connection pooling are 100% automatic, thanks to [urllib3](https://github.com/shazow/urllib3). Besides, all the cool kids are doing it. Requests is one of the most -downloaded Python packages of all time, pulling in over 11,000,000 +downloaded Python packages of all time, pulling in over 50,000,000 downloads every month. You don't want to be left out! Feature Support @@ -93,15 +93,15 @@ How to Contribute 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/). 2. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. There is a [Contributor - Friendly](https://github.com/requests/requests/issues?direction=desc&labels=Contributor+Friendly&page=1&sort=updated&state=open) + Friendly](https://github.com/psf/requests/issues?direction=desc&labels=Contributor+Friendly&page=1&sort=updated&state=open) tag for issues that should be ideal for people who are not very familiar with the codebase yet. -3. Fork [the repository](https://github.com/requests/requests) on +3. Fork [the repository](https://github.com/psf/requests) on GitHub to start making your changes to the **master** branch (or branch off of it). 4. Write a test which shows that the bug was fixed or that the feature works as expected. 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 and published. :) Make sure to add yourself to - [AUTHORS](https://github.com/requests/requests/blob/master/AUTHORS.rst). + [AUTHORS](https://github.com/psf/requests/blob/master/AUTHORS.rst). diff --git a/docs/_templates/sidebarintro.html b/docs/_templates/sidebarintro.html index 319954d1..867bcd3d 100644 --- a/docs/_templates/sidebarintro.html +++ b/docs/_templates/sidebarintro.html @@ -71,9 +71,9 @@

-
  • Requests @ GitHub
  • +
  • Requests @ GitHub
  • Requests @ PyPI
  • -
  • Issue Tracker
  • +
  • Issue Tracker
  • Release History
  • diff --git a/docs/community/support.rst b/docs/community/support.rst index 4b72bba8..23e35868 100644 --- a/docs/community/support.rst +++ b/docs/community/support.rst @@ -29,7 +29,7 @@ File an Issue If you notice some unexpected behaviour in Requests, or want to see support for a new feature, -`file an issue on GitHub `_. +`file an issue on GitHub `_. E-mail diff --git a/docs/community/updates.rst b/docs/community/updates.rst index 3ae0589f..ee08cdc5 100644 --- a/docs/community/updates.rst +++ b/docs/community/updates.rst @@ -14,7 +14,7 @@ GitHub ------ The best way to track the development of Requests is through -`the GitHub repo `_. +`the GitHub repo `_. Twitter ------- diff --git a/docs/dev/contributing.rst b/docs/dev/contributing.rst index d1171cb9..308fdd25 100644 --- a/docs/dev/contributing.rst +++ b/docs/dev/contributing.rst @@ -130,7 +130,14 @@ the Requests codebase:: foo = long_function_name(var_one, var_two, var_three, var_four) -No. Just don't. Please. +No. Just don't. Please. This is much better:: + + foo = long_function_name( + var_one, + var_two, + var_three, + var_four, + ) Docstrings are to follow the following syntaxes:: @@ -190,7 +197,7 @@ through the `GitHub issues`_, **both open and closed**, to confirm that the bug hasn't been reported before. Duplicate bug reports are a huge drain on the time of other contributors, and should be avoided as much as possible. -.. _GitHub issues: https://github.com/requests/requests/issues +.. _GitHub issues: https://github.com/psf/requests/issues Feature Requests diff --git a/docs/dev/todo.rst b/docs/dev/todo.rst index 26cd9b71..d09fce39 100644 --- a/docs/dev/todo.rst +++ b/docs/dev/todo.rst @@ -8,11 +8,11 @@ Requests is under active development, and contributions are more than welcome! #. Check for open issues or open a fresh issue to start a discussion around a bug. There is a Contributor Friendly tag for issues that should be ideal for people who are not very familiar with the codebase yet. -#. Fork `the repository `_ on GitHub and start making your +#. Fork `the repository `_ on GitHub and start making your changes to a new branch. #. Write a test which shows that the bug was fixed. #. Send a pull request and bug the maintainer until it gets merged and published. :) - Make sure to add yourself to `AUTHORS `_. + Make sure to add yourself to `AUTHORS `_. Feature Freeze -------------- diff --git a/docs/index.rst b/docs/index.rst index f44340b7..5085503a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -17,8 +17,8 @@ Release v\ |version|. (:ref:`Installation `) .. image:: https://img.shields.io/pypi/pyversions/requests.svg :target: https://pypi.org/project/requests/ -.. image:: https://codecov.io/github/requests/requests/coverage.svg?branch=master - :target: https://codecov.io/github/requests/requests +.. image:: https://codecov.io/github/psf/requests/coverage.svg?branch=master + :target: https://codecov.io/github/psf/requests :alt: codecov.io .. image:: https://img.shields.io/badge/Say%20Thanks!-🦉-1EAEDB.svg diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst index f1b7460d..728ffbb6 100644 --- a/docs/user/advanced.rst +++ b/docs/user/advanced.rst @@ -193,7 +193,7 @@ When you are using the prepared request flow, keep in mind that it does not take This can cause problems if you are using environment variables to change the behaviour of requests. For example: Self-signed SSL certificates specified in ``REQUESTS_CA_BUNDLE`` will not be taken into account. As a result an ``SSL: CERTIFICATE_VERIFY_FAILED`` is thrown. -You can get around this behaviour by explicity merging the environment settings into your session:: +You can get around this behaviour by explicitly merging the environment settings into your session:: from requests import Request, Session @@ -300,7 +300,7 @@ immediately. You can override this behaviour and defer downloading the response body until you access the :attr:`Response.content ` attribute with the ``stream`` parameter:: - tarball_url = 'https://github.com/requests/requests/tarball/master' + tarball_url = 'https://github.com/psf/requests/tarball/master' r = requests.get(tarball_url, stream=True) At this point only the response headers have been downloaded and the connection @@ -680,7 +680,7 @@ from GitHub. Suppose we wanted commit ``a050faf`` on Requests. We would get it like so:: >>> import requests - >>> r = requests.get('https://api.github.com/repos/requests/requests/git/commits/a050faf084662f3a352dd1a941f2c7c9f886d4ad') + >>> r = requests.get('https://api.github.com/repos/psf/requests/git/commits/a050faf084662f3a352dd1a941f2c7c9f886d4ad') We should confirm that GitHub responded correctly. If it has, we want to work out what type of content it is. Do this like so:: @@ -735,12 +735,12 @@ we should probably avoid making ham-handed POSTS to it. Instead, let's play with the Issues feature of GitHub. This documentation was added in response to -`Issue #482 `_. Given that +`Issue #482 `_. Given that this issue already exists, we will use it as an example. Let's start by getting it. :: - >>> r = requests.get('https://api.github.com/repos/requests/requests/issues/482') + >>> r = requests.get('https://api.github.com/repos/psf/requests/issues/482') >>> r.status_code 200 @@ -783,7 +783,7 @@ is to POST to the thread. Let's do it. :: >>> body = json.dumps({u"body": u"Sounds great! I'll get right on it!"}) - >>> url = u"https://api.github.com/repos/requests/requests/issues/482/comments" + >>> url = u"https://api.github.com/repos/psf/requests/issues/482/comments" >>> r = requests.post(url=url, data=body) >>> r.status_code @@ -817,7 +817,7 @@ that. 5804413 >>> body = json.dumps({u"body": u"Sounds great! I'll get right on it once I feed my cat."}) - >>> url = u"https://api.github.com/repos/requests/requests/issues/comments/5804413" + >>> url = u"https://api.github.com/repos/psf/requests/issues/comments/5804413" >>> r = requests.patch(url=url, data=body, auth=auth) >>> r.status_code diff --git a/docs/user/install.rst b/docs/user/install.rst index 3888876a..73e69f29 100644 --- a/docs/user/install.rst +++ b/docs/user/install.rst @@ -25,15 +25,15 @@ Get the Source Code ------------------- Requests is actively developed on GitHub, where the code is -`always available `_. +`always available `_. You can either clone the public repository:: - $ git clone git://github.com/requests/requests.git + $ git clone git://github.com/psf/requests.git -Or, download the `tarball `_:: +Or, download the `tarball `_:: - $ curl -OL https://github.com/requests/requests/tarball/master + $ curl -OL https://github.com/psf/requests/tarball/master # optionally, zipball is also available (for Windows users). Once you have a copy of the source, you can embed it in your own Python diff --git a/requests/api.py b/requests/api.py index ef71d075..88cfdceb 100644 --- a/requests/api.py +++ b/requests/api.py @@ -16,7 +16,7 @@ from . import sessions def request(method, url, **kwargs): """Constructs and sends a :class:`Request `. - :param method: method for the new :class:`Request` object. + :param method: method for the new :class:`Request` object: ``GET``, ``OPTIONS``, ``HEAD``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary, list of tuples or bytes to send in the query string for the :class:`Request`. @@ -92,7 +92,9 @@ def head(url, **kwargs): r"""Sends a HEAD request. :param url: URL for the new :class:`Request` object. - :param \*\*kwargs: Optional arguments that ``request`` takes. + :param \*\*kwargs: Optional arguments that ``request`` takes. If + `allow_redirects` is not provided, it will be set to `False` (as + opposed to the default :meth:`request` behavior). :return: :class:`Response ` object :rtype: requests.Response """ diff --git a/requests/auth.py b/requests/auth.py index 34e7c8b8..eeface39 100644 --- a/requests/auth.py +++ b/requests/auth.py @@ -239,7 +239,7 @@ class HTTPDigestAuth(AuthBase): """ # If response is not 4xx, do not auth - # See https://github.com/requests/requests/issues/3772 + # See https://github.com/psf/requests/issues/3772 if not 400 <= r.status_code < 500: self._thread_local.num_401_calls = 1 return r diff --git a/requests/models.py b/requests/models.py index 62dcd0b7..457b8412 100644 --- a/requests/models.py +++ b/requests/models.py @@ -12,7 +12,7 @@ import sys # Import encoding now, to avoid implicit import later. # Implicit import within threads may cause LookupError when standard library is in a ZIP, -# such as in Embedded Python. See https://github.com/requests/requests/issues/3578. +# such as in Embedded Python. See https://github.com/psf/requests/issues/3578. import encodings.idna from urllib3.fields import RequestField @@ -358,7 +358,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): #: We're unable to blindly call unicode/str functions #: as this will include the bytestring indicator (b'') #: on python 3.x. - #: https://github.com/requests/requests/pull/2238 + #: https://github.com/psf/requests/pull/2238 if isinstance(url, bytes): url = url.decode('utf8') else: diff --git a/requests/sessions.py b/requests/sessions.py index 1043d513..b8a123dd 100644 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -192,9 +192,9 @@ class SessionRedirectMixin(object): self.rebuild_method(prepared_request, resp) - # https://github.com/requests/requests/issues/1084 + # https://github.com/psf/requests/issues/1084 if resp.status_code not in (codes.temporary_redirect, codes.permanent_redirect): - # https://github.com/requests/requests/issues/3490 + # https://github.com/psf/requests/issues/3490 purged_headers = ('Content-Length', 'Content-Type', 'Transfer-Encoding') for header in purged_headers: prepared_request.headers.pop(header, None) diff --git a/requests/utils.py b/requests/utils.py index 8170a8d2..28c9366e 100644 --- a/requests/utils.py +++ b/requests/utils.py @@ -179,7 +179,7 @@ def get_netrc_auth(url, raise_errors=False): except KeyError: # os.path.expanduser can fail when $HOME is undefined and # getpwuid fails. See https://bugs.python.org/issue20164 & - # https://github.com/requests/requests/issues/1846 + # https://github.com/psf/requests/issues/1846 return if os.path.exists(loc): diff --git a/tests/test_lowlevel.py b/tests/test_lowlevel.py index 82c3b25a..4127fb11 100644 --- a/tests/test_lowlevel.py +++ b/tests/test_lowlevel.py @@ -28,7 +28,7 @@ def test_digestauth_401_count_reset_on_redirect(): """Ensure we correctly reset num_401_calls after a successful digest auth, followed by a 302 redirect to another digest auth prompt. - See https://github.com/requests/requests/issues/1979. + See https://github.com/psf/requests/issues/1979. """ text_401 = (b'HTTP/1.1 401 UNAUTHORIZED\r\n' b'Content-Length: 0\r\n' @@ -138,7 +138,7 @@ def test_digestauth_401_only_sent_once(): def test_digestauth_only_on_4xx(): """Ensure we only send digestauth on 4xx challenges. - See https://github.com/requests/requests/issues/3772. + See https://github.com/psf/requests/issues/3772. """ text_200_chal = (b'HTTP/1.1 200 OK\r\n' b'Content-Length: 0\r\n' diff --git a/tests/test_requests.py b/tests/test_requests.py index 89eff885..8bac4b19 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -466,7 +466,7 @@ class TestRequests: @pytest.mark.parametrize('key', ('User-agent', 'user-agent')) def test_user_agent_transfers(self, httpbin, key): - heads = {key: 'Mozilla/5.0 (github.com/requests/requests)'} + heads = {key: 'Mozilla/5.0 (github.com/psf/requests)'} r = requests.get(httpbin('user-agent'), headers=heads) assert heads[key] in r.text @@ -2212,7 +2212,7 @@ class TestTimeout: pass def test_encoded_methods(self, httpbin): - """See: https://github.com/requests/requests/issues/2316""" + """See: https://github.com/psf/requests/issues/2316""" r = requests.request(b'GET', httpbin('get')) assert r.ok diff --git a/tests/test_utils.py b/tests/test_utils.py index 59b0b0ef..4fe9c1f0 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -397,7 +397,7 @@ def test_get_auth_from_url(url, auth): ), )) def test_requote_uri_with_unquoted_percents(uri, expected): - """See: https://github.com/requests/requests/issues/2356""" + """See: https://github.com/psf/requests/issues/2356""" assert requote_uri(uri) == expected