CacheControl

httplib2 caching for requests

52 个版本 Python >=3.10
Eric Larson, Frost Ming, William Woodruff <Eric Larson <ericlarson@ionrock.com>, Frost Ming <me@frostming.com>, William Woodruff <william@yossarian.net>>
安装
pip install CacheControl
poetry add CacheControl
pipenv install CacheControl
conda install CacheControl
描述

.. SPDX-FileCopyrightText: SPDX-FileCopyrightText: 2015 Eric Larson

SPDX-License-Identifier: Apache-2.0

============== CacheControl

.. image:: https://img.shields.io/pypi/v/cachecontrol.svg :target: https://pypi.python.org/pypi/cachecontrol :alt: Latest Version

.. image:: https://github.com/psf/cachecontrol/actions/workflows/tests.yml/badge.svg :target: https://github.com/psf/cachecontrol/actions/workflows/tests.yml

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

.. code-block:: python

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_

.. _docs: http://cachecontrol.readthedocs.org/en/latest/ .. _httplib2: https://github.com/httplib2/httplib2 .. _requests: http://docs.python-requests.org/

版本列表
0.14.4 2025-11-14
0.14.3 2025-04-30
0.14.2 2025-01-07
0.14.1 2024-11-04
0.14.0 2024-02-02
0.13.1 2023-06-08
0.13.0 2023-06-01
0.13.1rc0 2023-06-08
0.12.14 2023-06-06
0.12.13 2023-06-05
0.12.12 2022-09-12
0.12.11 2022-04-19
0.12.10 2021-11-05
0.12.9 2021-11-02
0.12.8 2021-10-29
0.12.7 2021-10-29
0.12.6 2019-12-22
0.12.5 2018-06-07
0.12.4 2018-01-27
0.12.3 2017-05-25
0.12.2 2017-03-27
0.12.1 2017-03-14
0.12.0 2017-01-30
0.11.7 2016-09-13
0.11.6 2016-01-19
0.11.5 2015-05-20
0.11.4 2015-05-16
0.11.3 2015-05-11
0.11.2 2015-03-19
0.11.1 2015-01-28
0.11.0 2015-01-28
0.10.7 2014-12-18
0.10.6 2014-12-04
0.10.4 2014-09-17
0.10.3 2014-09-10
0.10.2 2014-07-03
0.10.1 2014-05-08
0.10.0 2014-04-24
0.9.4 2014-04-24
0.9.3 2014-03-13
0.9.2 2014-01-12
0.9.1 2014-01-12
0.9.0 2014-01-12
0.8.3 2013-11-26
0.8.2 2013-11-26
0.8.1 2013-11-26
0.8.0 2013-11-26
0.7.3 2013-11-13
0.7.2 2013-11-08
0.7.1 2013-11-07
0.6 2013-06-20
0.5 2013-06-18