Current Path: > > usr > lib > python2.7 > site-packages > pip > _vendor > > urllib3 > > util
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
__init__.py | File | 1044 bytes | April 21 2022 18:08:21. | |
__init__.pyc | File | 1277 bytes | April 21 2022 18:08:35. | |
__init__.pyo | File | 1277 bytes | April 21 2022 18:08:35. | |
connection.py | File | 4237 bytes | April 21 2022 18:08:21. | |
connection.pyc | File | 3871 bytes | April 21 2022 18:08:35. | |
connection.pyo | File | 3871 bytes | April 21 2022 18:08:35. | |
request.py | File | 3705 bytes | April 21 2022 18:08:21. | |
request.pyc | File | 3757 bytes | April 21 2022 18:08:35. | |
request.pyo | File | 3757 bytes | April 21 2022 18:08:35. | |
response.py | File | 2343 bytes | April 21 2022 18:08:21. | |
response.pyc | File | 2297 bytes | April 21 2022 18:08:35. | |
response.pyo | File | 2297 bytes | April 21 2022 18:08:35. | |
retry.py | File | 15104 bytes | April 21 2022 18:08:21. | |
retry.pyc | File | 14728 bytes | April 21 2022 18:08:35. | |
retry.pyo | File | 14728 bytes | April 21 2022 18:08:35. | |
selectors.py | File | 21147 bytes | April 21 2022 18:08:21. | |
selectors.pyc | File | 20985 bytes | April 21 2022 18:08:35. | |
selectors.pyo | File | 20985 bytes | April 21 2022 18:08:35. | |
ssl_.py | File | 12214 bytes | April 21 2022 18:08:21. | |
ssl_.pyc | File | 10605 bytes | April 21 2022 18:08:35. | |
ssl_.pyo | File | 10605 bytes | April 21 2022 18:08:35. | |
timeout.py | File | 9757 bytes | April 21 2022 18:08:21. | |
timeout.pyc | File | 9716 bytes | April 21 2022 18:08:35. | |
timeout.pyo | File | 9716 bytes | April 21 2022 18:08:35. | |
url.py | File | 6798 bytes | April 21 2022 18:08:21. | |
url.pyc | File | 6773 bytes | April 21 2022 18:08:35. | |
url.pyo | File | 6773 bytes | April 21 2022 18:08:35. | |
wait.py | File | 1451 bytes | April 21 2022 18:08:21. | |
wait.pyc | File | 1842 bytes | April 21 2022 18:08:35. | |
wait.pyo | File | 1842 bytes | April 21 2022 18:08:35. |
from __future__ import absolute_import from base64 import b64encode from ..packages.six import b, integer_types from ..exceptions import UnrewindableBodyError ACCEPT_ENCODING = 'gzip,deflate' _FAILEDTELL = object() def make_headers(keep_alive=None, accept_encoding=None, user_agent=None, basic_auth=None, proxy_basic_auth=None, disable_cache=None): """ Shortcuts for generating request headers. :param keep_alive: If ``True``, adds 'connection: keep-alive' header. :param accept_encoding: Can be a boolean, list, or string. ``True`` translates to 'gzip,deflate'. List will get joined by comma. String will be used as provided. :param user_agent: String representing the user-agent you want, such as "python-urllib3/0.6" :param basic_auth: Colon-separated username:password string for 'authorization: basic ...' auth header. :param proxy_basic_auth: Colon-separated username:password string for 'proxy-authorization: basic ...' auth header. :param disable_cache: If ``True``, adds 'cache-control: no-cache' header. Example:: >>> make_headers(keep_alive=True, user_agent="Batman/1.0") {'connection': 'keep-alive', 'user-agent': 'Batman/1.0'} >>> make_headers(accept_encoding=True) {'accept-encoding': 'gzip,deflate'} """ headers = {} if accept_encoding: if isinstance(accept_encoding, str): pass elif isinstance(accept_encoding, list): accept_encoding = ','.join(accept_encoding) else: accept_encoding = ACCEPT_ENCODING headers['accept-encoding'] = accept_encoding if user_agent: headers['user-agent'] = user_agent if keep_alive: headers['connection'] = 'keep-alive' if basic_auth: headers['authorization'] = 'Basic ' + \ b64encode(b(basic_auth)).decode('utf-8') if proxy_basic_auth: headers['proxy-authorization'] = 'Basic ' + \ b64encode(b(proxy_basic_auth)).decode('utf-8') if disable_cache: headers['cache-control'] = 'no-cache' return headers def set_file_position(body, pos): """ If a position is provided, move file to that point. Otherwise, we'll attempt to record a position for future use. """ if pos is not None: rewind_body(body, pos) elif getattr(body, 'tell', None) is not None: try: pos = body.tell() except (IOError, OSError): # This differentiates from None, allowing us to catch # a failed `tell()` later when trying to rewind the body. pos = _FAILEDTELL return pos def rewind_body(body, body_pos): """ Attempt to rewind body to a certain position. Primarily used for request redirects and retries. :param body: File-like object that supports seek. :param int pos: Position to seek to in file. """ body_seek = getattr(body, 'seek', None) if body_seek is not None and isinstance(body_pos, integer_types): try: body_seek(body_pos) except (IOError, OSError): raise UnrewindableBodyError("An error occurred when rewinding request " "body for redirect/retry.") elif body_pos is _FAILEDTELL: raise UnrewindableBodyError("Unable to record file position for rewinding " "request body during a redirect/retry.") else: raise ValueError("body_pos must be of type integer, " "instead it was %s." % type(body_pos))
SILENT KILLER Tool