Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
willforde committed Mar 9, 2021
1 parent d5a9583 commit 5cb34d2
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Urlquick II: Requests, but with caching
=======================================
# Urlquick II: Requests, but with caching

[![PyPI](https://img.shields.io/pypi/v/urlquick)](https://pypi.org/project/urlquick/)
[![Documentation Status](https://readthedocs.org/projects/urlquick/badge/?version=stable)](https://urlquick.readthedocs.io/en/stable/?badge=stable)
Expand All @@ -8,8 +7,7 @@ Urlquick II: Requests, but with caching
[![Maintainability](https://api.codeclimate.com/v1/badges/4f622589a4b8e24ac996/maintainability)](https://codeclimate.com/github/willforde/urlquick/maintainability)


Urlquick II
-----------
## Urlquick II
Urlquick2 is a wrapper for requests that add's support for http caching.
It act's just like requests but with a few extra parameters and features.
'Requests' itself is left untouched.
Expand All @@ -19,32 +17,36 @@ conditional headers are added to any new request e.g. "Etag" and "Last-modified"
returns a 304 Not-Modified response, the cache is used, saving having to re-download the content body.


Usage
-----
## Usage

```python
>>> from urlquick import Session
>>> import urlquick

# Make a connection pool.
>>> http = Session()

# Make a request.
>>> r = http.get('https://httpbin.org/ip')

# View response data.
# Make a simple request to check ip address.
>>> r = urlquick.get('https://httpbin.org/ip')
>>> r.json()
{'ip': '172.69.48.124'}

# Take note of the elapsed time.
>>> r.elapsed
0:00:00.556889

# Now make the same request but notice the much lower elapsed time.
>>> r = urlquick.get('https://httpbin.org/ip')
>>> r.elapsed
0:00:00.000184

# To change the max age for the cache to 1 hour.
>>> r = urlquick.get('https://httpbin.org/ip', max_age=60*60)
# max_age of -1 will disable the caching system.
# max_age of 0 will send conditional headers to check if content needs to be redownloaded.
```


Install
-------
## Install
Stable
```console
$ pip install urlquick
```

Unstable
```console
$ pip install git+https://github.com/willforde/urlquick.git
```
## Full Documentation over at [Read the Docs](https://urlquick.readthedocs.io)

0 comments on commit 5cb34d2

Please sign in to comment.