aboutsummaryrefslogtreecommitdiff
path: root/urllib3/util/request.py
diff options
context:
space:
mode:
authorSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:19:38 -0700
committerSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:19:38 -0700
commit73be7d6cc85a90ab4f67ffc27dc7eae672f7741f (patch)
tree4030bad5fec3d40cf93a20a2e26a165adf1ddbbd /urllib3/util/request.py
parent35fb123b995cbbe27d3edd5ed14abc6e56b7ad13 (diff)
downloadpython-urllib3-73be7d6cc85a90ab4f67ffc27dc7eae672f7741f.tar
python-urllib3-73be7d6cc85a90ab4f67ffc27dc7eae672f7741f.tar.gz
Imported Upstream version 1.8.3
Diffstat (limited to 'urllib3/util/request.py')
-rw-r--r--urllib3/util/request.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/urllib3/util/request.py b/urllib3/util/request.py
index d48d651..bfd7a98 100644
--- a/urllib3/util/request.py
+++ b/urllib3/util/request.py
@@ -7,7 +7,7 @@ ACCEPT_ENCODING = 'gzip,deflate'
def make_headers(keep_alive=None, accept_encoding=None, user_agent=None,
- basic_auth=None, proxy_basic_auth=None):
+ basic_auth=None, proxy_basic_auth=None, disable_cache=None):
"""
Shortcuts for generating request headers.
@@ -29,8 +29,11 @@ def make_headers(keep_alive=None, accept_encoding=None, user_agent=None,
auth header.
:param proxy_basic_auth:
- Colon-separated username:password string for 'proxy-authorization: basic ...'
- auth header.
+ Colon-separated username:password string for
+ 'proxy-authorization: basic ...' auth header.
+
+ :param disable_cache:
+ If ``True``, adds 'cache-control: no-cache' header.
Example: ::
@@ -63,6 +66,7 @@ def make_headers(keep_alive=None, accept_encoding=None, user_agent=None,
headers['proxy-authorization'] = 'Basic ' + \
b64encode(six.b(proxy_basic_auth)).decode('utf-8')
- return headers
-
+ if disable_cache:
+ headers['cache-control'] = 'no-cache'
+ return headers