Skip to main content

Requests-Cache

Build Coverage Documentation PyPI PyPI - Python Versions PyPI - Format Code Shelter

Summary

requests-cache is a transparent, persistent HTTP cache for the python requests library. It's a convenient tool to use with web scraping, consuming REST APIs, slow or rate-limited sites, or any other scenario in which you're making lots of requests that are expensive and/or likely to be sent more than once.

See full project documentation at: https://requests-cache.readthedocs.io

Features

Quickstart

First, install with pip:

pip install requests-cache

Next, use requests_cache.CachedSession to send and cache requests. To quickly demonstrate how to use it:

This takes ~1 minute:

import requests

session = requests.Session()
for i in range(60):
    session.get('http://httpbin.org/delay/1')

This takes ~1 second:

import requests_cache

session = requests_cache.CachedSession('demo_cache')
for i in range(60):
    session.get('http://httpbin.org/delay/1')

The URL in this example adds a delay of 1 second, simulating a slow or rate-limited website. With caching, the response will be fetched once, saved to demo_cache.sqlite, and subsequent requests will return the cached response near-instantly.

If you don't want to manage a session object, requests-cache can also be installed globally:

requests_cache.install_cache('demo_cache')
requests.get('http://httpbin.org/delay/1')

Next Steps

To find out more about what you can do with requests-cache, see:

Metadata

Release files for requests-cache 0.7.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for requests-cache 0.7.3
File Size Uploaded
requests-cache-0.7.3.tar.gz 1.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for requests-cache 0.7.3
File Interpreter ABI Platform
requests_cache-0.7.3-py3-none-any.whl Python 3 none any Details

Total release size: 1.2 MB

Release files / requests-cache-0.7.3.tar.gz

Download URL requests-cache-0.7.3.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
d17c95b0fa52670044356378886dbaf8e25069123d4fced43e05cd13b38c42f8
BLAKE2b-256 checksum
How to use checksums
8d2bda81970c0adfacb9435e633c3d6d90ab328b046d26ef66276d9c7ddfda18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0a2 CPython/3.9.6 Linux/5.4.0-1055-azure

Release files / requests_cache-0.7.3-py3-none-any.whl

Download URL requests_cache-0.7.3-py3-none-any.whl
Size 53.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cae8d3484896e2b1779a87e9ca7f44c7ca95d71614705978d6be9397f56e7f3a
BLAKE2b-256 checksum
How to use checksums
664fd260988baf0c1b6090b24005c05d977745ad530cc6b424f8dd2eb9be8d14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0a2 CPython/3.9.6 Linux/5.4.0-1055-azure

Release history Release notifications | RSS feed

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.8

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.5

2 release files

0.7.4

2 release files

This release

0.7.3 This release

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.13

2 release files

0.4.12

2 release files

0.4.10

3 release files

0.4.9

3 release files

0.4.8

3 release files

0.4.7

3 release files

0.4.6

3 release files

0.4.5

3 release files

0.4.4

3 release files

0.4.3

3 release files

0.4.2

3 release files

0.4.1

3 release files

0.4.0

3 release files

0.3.0

3 release files

0.2.1

3 release files

0.2.0

3 release files

0.1.3

3 release files

0.1.2

3 release files

0.1.1

3 release files

0.1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page