Skip to main content

Requests wrapper that add's support for HTTP caching. It act's just like requests but with a few extra parameters and features.

Project description

Urlquick II: Requests, but with caching

PyPI Documentation Status Build Status Coverage Status Maintainability

Urlquick II

Urlquick 2 is a wrapper for requests that add's support for http caching. It acts just like requests but with a few extra parameters and features. 'Requests' itself is left untouched.

All GET, HEAD and POST requests are cached locally for a period of 4 hours, this can be changed. When the cache expires, conditional headers are added to any new request e.g. "Etag" and "Last-modified". Then if the server returns a 304 Not-Modified response, the cache is used, saving having to re-download the content body.

All of Requests get, head, post and request functions/methods all get 2 extra optional parameters. Both these 2 parameters can also be set on a session object too.

  • max_age: Age the 'cache' can be before it’s considered stale.
  • raise_for_status: Boolean that when set to True will call resp.raise_for_status() for you automatically.

The Requests response objects also gets too new methods.

  • parse(): Parse’s “HTML” document into a element tree using HTMLement.
  • xml(): Parse’s XML document into a element tree.


>>> import urlquick

# Make a simple request to check ip address.
>>> r = urlquick.get('')
>>> r.json()
{'ip': ''}

# Take note of the elapsed time.
>>> r.elapsed

# Now make the same request but notice the much lower elapsed time.
>>> r = urlquick.get('')
>>> r.elapsed

# To change the max age for the cache to 1 hour.
>>> r = urlquick.get('', 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.


Urlquick 2 officially supports Python 2.7 & 3.6+.

$ pip install urlquick

Full Documentation over at Read the Docs

Project details

Download files

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

Source Distribution

urlquick-2.0.1.tar.gz (13.7 kB view hashes)

Uploaded source

Built Distribution

urlquick-2.0.1-py2.py3-none-any.whl (9.9 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page