Skip to content

The httplib2 caching algorithms packaged up for use with requests.

License

Notifications You must be signed in to change notification settings

psf/cachecontrol

Folders and files

NameName
Last commit message
Last commit date
Apr 7, 2025
Jan 7, 2025
Jan 7, 2025
Oct 18, 2023
Jan 9, 2025
Nov 29, 2021
Jun 8, 2023
Jun 25, 2020
Nov 5, 2021
Apr 28, 2024
Aug 21, 2023
Nov 4, 2024
Oct 18, 2023

Repository files navigation

CacheControl

Latest Version

CacheControl is a port of the caching algorithms in httplib2 for use with requests session object.

It was written because httplib2's better support for caching is often mitigated by its lack of thread safety. The same is true of requests in terms of caching.

Quickstart

import requests

from cachecontrol import CacheControl


sess = requests.session()
cached_sess = CacheControl(sess)

response = cached_sess.get('https://google.com')

If the URL contains any caching based headers, it will cache the result in a simple dictionary.

For more info, check out the docs