Coder Social home page Coder Social logo

gfertel / requests-cache Goto Github PK

View Code? Open in Web Editor NEW

This project forked from requests-cache/requests-cache

0.0 1.0 0.0 266 KB

Transparent persistent cache for http://python-requests.org/ library

Home Page: http://pypi.python.org/pypi/requests-cache

License: BSD 2-Clause "Simplified" License

Python 100.00%

requests-cache's Introduction

requests-cache

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

https://travis-ci.org/reclosedev/requests-cache.svg?branch=master https://coveralls.io/repos/reclosedev/requests-cache/badge.svg?branch=master&service=github

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 of 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.

Links

requests-cache's People

Contributors

reclosedev avatar rgant avatar michaelbeaumont avatar themiurgo avatar yetanothernerd avatar mgax avatar meowcoder avatar andrewkittredge avatar chengguangnan avatar craigls avatar garrett-r avatar msabramo avatar ar90n avatar mjhea0 avatar femtotrader avatar

Watchers

Greg Fertel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.