From c8d8b4b513986ef415cdfbcf0fc6006bcd5492d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20Ko=C5=82odziej?= Date: Mon, 1 Jul 2019 21:27:18 +0200 Subject: [PATCH 1/6] Document that `request.head` defaults `allow_redirects` to `False` Related: kennethreitz/requests#4274 --- requests/api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/requests/api.py b/requests/api.py index ef71d075..1ed6d861 100644 --- a/requests/api.py +++ b/requests/api.py @@ -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 """ From fb7efcf3f1cb1fb91214bfc6291090a7903f2a31 Mon Sep 17 00:00:00 2001 From: Dull Bananas Date: Sat, 20 Jul 2019 09:17:54 -0700 Subject: [PATCH 2/6] Add example of good code below example of bad code --- docs/dev/contributing.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/dev/contributing.rst b/docs/dev/contributing.rst index d1171cb9..434dc565 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:: From 50daf9c0050f885bcc1276d01889c35b52ea3734 Mon Sep 17 00:00:00 2001 From: Dull Bananas Date: Sat, 20 Jul 2019 09:23:52 -0700 Subject: [PATCH 3/6] Add .eggs dir to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) 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 From ebd3e36ad526a9a6af08ed2045b709ba0a2b5df4 Mon Sep 17 00:00:00 2001 From: Dull Bananas Date: Sat, 20 Jul 2019 09:29:50 -0700 Subject: [PATCH 4/6] Add 'Dull Bananas' to AUTHORS --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index f0ee696b..c0aa943b 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 Date: Sat, 20 Jul 2019 09:31:39 -0700 Subject: [PATCH 5/6] Fix GitHub profile link --- AUTHORS.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index c0aa943b..22147342 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -189,4 +189,4 @@ Patches and Suggestions - Darren Dormer (`@ddormer `_) - Rajiv Mayani (`@mayani `_) - Antti Kaihola (`@akaihola `_) -- "Dull Bananas" (`@dullbananas (`@dullbananas `_) From c79d61b9537635e88c3198172c58e29cf6ef26d5 Mon Sep 17 00:00:00 2001 From: Dull Bananas Date: Sat, 20 Jul 2019 15:32:04 -0700 Subject: [PATCH 6/6] List valid methods for request() --- requests/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requests/api.py b/requests/api.py index 1ed6d861..232b01d9 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`.