Skip to main content

requests-cache

Requests-cache is a transparent persistent cache for requests (version >= 1.1.0) library.

Usage example

Just write:

import requests
import requests_cache

requests_cache.install_cache('demo_cache')

And all responses with headers and cookies will be transparently cached to demo_cache.sqlite database. For example, following code will take only 1-2 seconds instead 10, and will run instantly on next launch:

for i in range(10):
    requests.get('http://httpbin.org/delay/1')

It can be useful when you are creating some simple data scraper with constantly changing parsing logic or data format, and don’t want to redownload pages or write complex error handling and persistence.

Note

requests-cache ignores all cache headers, it just caches the data for the time you specify.

If you need library which knows how to use HTTP headers and status codes, take a look at httpcache and CacheControl.

History

0.4.5 (2014-08-22)

  • Requests==2.3.0 compatibility, thanks to @gwillem

0.4.4 (2013-10-31)

  • Check for backend availability in install_cache(), not at the first request

  • Default storage fallbacks to memory if sqlite is not available

0.4.3 (2013-09-12)

  • Fix response.from_cache not set in hooks

0.4.2 (2013-08-25)

  • Fix UnpickleableError for gzip responses

0.4.1 (2013-08-19)

  • requests_cache.enabled() context manager

  • Compatibility with Requests 1.2.3 cookies handling

0.4.0 (2013-04-25)

  • Redis backend. Thanks to @michaelbeaumont

  • Fix for changes in Requests 1.2.0 hooks dispatching

0.3.0 (2013-02-24)

  • Support for Requests 1.x.x

  • CachedSession

  • Many backward incompatible changes

0.2.1 (2013-01-13)

  • Fix broken PyPi package

0.2.0 (2013-01-12)

  • Last backward compatible version for Requests 0.14.2

0.1.3 (2012-05-04)

  • Thread safety for default sqlite backend

  • Take into account the POST parameters when cache is configured with ‘POST’ in allowable_methods

0.1.2 (2012-05-02)

  • Reduce number of sqlite database write operations

  • fast_save option for sqlite backend

0.1.1 (2012-04-11)

  • Fix: restore responses from response.history

  • Internal refactoring (MemoryCache -> BaseCache, reduce_response and restore_response moved to BaseCache)

  • connection option for MongoCache

0.1.0 (2012-04-10)

  • initial PyPI release

Metadata

Release files for requests-cache 0.4.5

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

Source distributions (sdists)

Source distribution for requests-cache 0.4.5
File Size Uploaded
requests-cache-0.4.5.zip 39.6 kB Details
requests-cache-0.4.5.tar.gz 25.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for requests-cache 0.4.5
File Interpreter ABI Platform
requests-cache-0.4.5.win32.exe Details

Total release size: 282.7 kB

Release files / requests-cache-0.4.5.zip

Download URL requests-cache-0.4.5.zip
Size 39.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4bbda496b9ec2ad39773d95eefa99128addf450ed0b817b403409081d62f23f6
BLAKE2b-256 checksum
How to use checksums
3a64139dd6e8cb02bff75d51e4b971cd5765f83512748c00b1db9e7693e7b81c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL requests-cache-0.4.5.tar.gz
Size 25.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ab5bd4b2508158bb57b25042ecbac840b7f6035ef940314897ce0efe13112c7b
BLAKE2b-256 checksum
How to use checksums
9d59b2dc047a1f0e5d188ef30bf63eb2086f9eba6a48d32a351fd8aaa7198d79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / requests-cache-0.4.5.win32.exe

Download URL requests-cache-0.4.5.win32.exe
Size 217.7 kB
Tags Source
SHA-256 checksum
How to use checksums
94369a37fafe6053cc4e33ac9ed42a313ee5591302c884ef1b724b44f726e6e1
BLAKE2b-256 checksum
How to use checksums
1ca8ed6d4821302793d29ad616c46ad97b459db6ffb8c55a269d12ee99bc8124
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

0.7.3

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

This release

0.4.5 This release

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