aboutsummaryrefslogtreecommitdiff
path: root/src/utils/http.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-06-26 17:53:16 +0100
committerGravatar jesopo2019-06-26 17:53:16 +0100
commit16d331dd43fbb148617c332c2ef14a19e5f5ef18 (patch)
tree4c60e51b05a3aad01725f2f856cf234830bad5fe /src/utils/http.py
parentShow commit message, not PR title, for PR pushes (diff)
signature
add `allow_redirects` kwarg to utils.http.request()
Diffstat (limited to 'src/utils/http.py')
-rw-r--r--src/utils/http.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/utils/http.py b/src/utils/http.py
index b9379344..5dac7e90 100644
--- a/src/utils/http.py
+++ b/src/utils/http.py
@@ -35,6 +35,7 @@ def request(url: str, method: str="GET", get_params: dict={},
post_data: typing.Any=None, headers: dict={},
json_data: typing.Any=None, code: bool=False, json: bool=False,
soup: bool=False, parser: str="lxml", fallback_encoding: str="utf8",
+ allow_redirects: bool=True
) -> Response:
if not urllib.parse.urlparse(url).scheme:
@@ -55,6 +56,7 @@ def request(url: str, method: str="GET", get_params: dict={},
params=get_params,
data=post_data,
json=json_data,
+ allow_redirects=allow_redirects,
stream=True
)
response_content = response.raw.read(RESPONSE_MAX, decode_content=True)