MCPcopy Create free account
hub / github.com/psf/cachecontrol / main

Function main

cachecontrol/_cmd.py:46–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44
45
46def main() -> None:
47 args = get_args()
48 sess = get_session()
49
50 # Make a request to get a response
51 resp = sess.get(args.url)
52
53 # Turn on logging
54 setup_logging()
55
56 # try setting the cache
57 cache_controller: CacheController = (
58 sess.cache_controller # type: ignore[attr-defined]
59 )
60 cache_controller.cache_response(resp.request, resp.raw)
61
62 # Now try to get it
63 if cache_controller.cached_request(resp.request):
64 print("Cached!")
65 else:
66 print("Not cached :(")
67
68
69if __name__ == "__main__":

Callers 1

_cmd.pyFile · 0.85

Calls 6

get_argsFunction · 0.85
get_sessionFunction · 0.85
setup_loggingFunction · 0.85
cache_responseMethod · 0.80
cached_requestMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…