X7ROOT File Manager
Current Path:
/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol
usr
/
lib
/
python2.7
/
site-packages
/
pip
/
_vendor
/
cachecontrol
/
ðŸ“
..
📄
__init__.py
(302 B)
📄
__init__.pyc
(583 B)
📄
__init__.pyo
(583 B)
📄
_cmd.py
(1.29 KB)
📄
_cmd.pyc
(2.01 KB)
📄
_cmd.pyo
(2.01 KB)
📄
adapter.py
(4.5 KB)
📄
adapter.pyc
(3.44 KB)
📄
adapter.pyo
(3.44 KB)
📄
cache.py
(790 B)
📄
cache.pyc
(2.34 KB)
📄
cache.pyo
(2.34 KB)
ðŸ“
caches
📄
compat.py
(380 B)
📄
compat.pyc
(618 B)
📄
compat.pyo
(618 B)
📄
controller.py
(12.72 KB)
📄
controller.pyc
(8.87 KB)
📄
controller.pyo
(8.87 KB)
📄
filewrapper.py
(2.47 KB)
📄
filewrapper.pyc
(2.6 KB)
📄
filewrapper.pyo
(2.6 KB)
📄
heuristics.py
(4.04 KB)
📄
heuristics.pyc
(5.8 KB)
📄
heuristics.pyo
(5.8 KB)
📄
serialize.py
(6.38 KB)
📄
serialize.pyc
(5.95 KB)
📄
serialize.pyo
(5.95 KB)
📄
wrapper.py
(498 B)
📄
wrapper.pyc
(696 B)
📄
wrapper.pyo
(696 B)
Editing: _cmd.py
import logging from pip._vendor import requests from pip._vendor.cachecontrol.adapter import CacheControlAdapter from pip._vendor.cachecontrol.cache import DictCache from pip._vendor.cachecontrol.controller import logger from argparse import ArgumentParser def setup_logging(): logger.setLevel(logging.DEBUG) handler = logging.StreamHandler() logger.addHandler(handler) def get_session(): adapter = CacheControlAdapter( DictCache(), cache_etags=True, serializer=None, heuristic=None, ) sess = requests.Session() sess.mount('http://', adapter) sess.mount('https://', adapter) sess.cache_controller = adapter.controller return sess def get_args(): parser = ArgumentParser() parser.add_argument('url', help='The URL to try and cache') return parser.parse_args() def main(args=None): args = get_args() sess = get_session() # Make a request to get a response resp = sess.get(args.url) # Turn on logging setup_logging() # try setting the cache sess.cache_controller.cache_response(resp.request, resp.raw) # Now try to get it if sess.cache_controller.cached_request(resp.request): print('Cached!') else: print('Not cached :(') if __name__ == '__main__': main()
Upload File
Create Folder