[ SYSTEM ]: Linux srv.persadacompanies.com 4.18.0-553.56.1.el8_10.x86_64 #1 SMP Tue Jun 10 05:00:59 EDT 2025 x86_64
[ SERVER ]: Apache | PHP: 8.4.20
[ USER ]: persadamedika | IP: 45.64.1.108
GEFORCE FILE MANAGER
/
usr
/
lib
/
python3.6
/
site-packages
/
pip
/
_vendor
/
cachecontrol
/
UPLOAD:
NAME
SIZE
QUICK PERMS
ACTIONS
📁 __pycache__
SET
[ DEL ]
📁 caches
SET
[ DEL ]
📄 __init__.py
302 B
SET
[ EDIT ]
|
[ DEL ]
📄 _cmd.py
1,320 B
SET
[ EDIT ]
|
[ DEL ]
📄 adapter.py
4,608 B
SET
[ EDIT ]
|
[ DEL ]
📄 cache.py
790 B
SET
[ EDIT ]
|
[ DEL ]
📄 compat.py
380 B
SET
[ EDIT ]
|
[ DEL ]
📄 controller.py
13,024 B
SET
[ EDIT ]
|
[ DEL ]
📄 filewrapper.py
2,531 B
SET
[ EDIT ]
|
[ DEL ]
📄 heuristics.py
4,141 B
SET
[ EDIT ]
|
[ DEL ]
📄 serialize.py
6,536 B
SET
[ EDIT ]
|
[ DEL ]
📄 wrapper.py
498 B
SET
[ EDIT ]
|
[ DEL ]
DELETE SELECTED
[ CLOSE ]
EDIT: _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()