Skip to main content

Persistent cache for requests library

Project description

requests-cache

Requests-cache is a transparent persistent cache for requests library.

Usage example

Just write:

import requests
import requests_cache

requests_cache.configure('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.

History

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

requests-cache-0.2.0.zip (30.9 kB view hashes)

Uploaded Source

requests-cache-0.2.0.tar.gz (20.9 kB view hashes)

Uploaded Source

Built Distribution

requests-cache-0.2.0.win32.exe (210.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page