diff options
-rw-r--r-- | README.md | 34 | ||||
-rw-r--r-- | README.rst | 64 |
2 files changed, 34 insertions, 64 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..b71baac --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# requests-cache +Requests-cache is a transparent persistent cache for the [requests](http://python-requests.org) library (version 2+). + +## Installation +Install with pip: +``` +pip install requests-cache +``` + +## Usage example +```python +import requests_cache + +requests_cache.install_cache('demo_cache') +``` + +And all responses with headers and cookies will be transparently cached to `demo_cache.sqlite`. +For example, following the code will take only 1-2 seconds instead of 10, and will run instantly on next launch: + +```python +import requests + +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. + +## Links +- **Documentation** at [readthedocs](https://requests-cache.readthedocs.io) +- **Source code and issue tracking** at [GitHub](https://github.com/reclosedev/requests-cache) +- **Working example** at [Real Python](https://realpython.com/blog/python/caching-external-api-requests) diff --git a/README.rst b/README.rst deleted file mode 100644 index 68052dc..0000000 --- a/README.rst +++ /dev/null @@ -1,64 +0,0 @@ -requests-cache ---------------- - -Requests-cache is a transparent persistent cache for the requests_ library (version 2+). - -.. _requests: http://python-requests.org/ - -.. image:: https://travis-ci.org/reclosedev/requests-cache.svg?branch=master - :target: https://travis-ci.org/reclosedev/requests-cache - -.. image:: https://coveralls.io/repos/reclosedev/requests-cache/badge.svg?branch=master&service=github - :target: https://coveralls.io/github/reclosedev/requests-cache?branch=master - -.. image:: https://www.codeshelter.co/static/badges/badge-flat.svg - :target: https://www.codeshelter.co/ - :alt: Code Shelter - -Installation ------------- -Install with pip:: - - pip install requests-cache - -Usage example -------------- - -Just write: - -.. code-block:: python - - 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: - -.. code-block:: python - - 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 on cache headers ---------------------- - -``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 <https://github.com/Lukasa/httpcache>`_ and -`CacheControl <https://github.com/ionrock/cachecontrol>`_. - - -Links ------ -- **Documentation** at `readthedocs <https://requests-cache.readthedocs.io/>`_ -- **Source code and issue tracking** at `GitHub <https://github.com/reclosedev/requests-cache>`_. -- **Working example** at `Real Python <https://realpython.com/blog/python/caching-external-api-requests>`_. |