Urlquick II: Requests, but with caching
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 toTruewill callresp.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.
Usage
>>> import urlquick
# 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
Urlquick 2 officially supports Python 2.7 & 3.6+.
$ pip install urlquick
Full Documentation over at Read the Docs
Metadata
Release files for urlquick 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| urlquick-2.0.1.tar.gz | 13.7 kB | Without provenance | Details for urlquick-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| urlquick-2.0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for urlquick-2.0.1-py2.py3-none-any.whl |
Total release size: 23.7 kB
Release files / urlquick-2.0.1.tar.gz
| Download URL | urlquick-2.0.1.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e9bbcb1b3eaf312309b034b509d9e98063481bfad1e6db2184073aef2957c3d
|
|
BLAKE2b-256 checksum How to use checksums |
6da90d89e282ac97a4592569055cecae14adb42d6e4cecb038057d8228c3a184
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Release files / urlquick-2.0.1-py2.py3-none-any.whl
| Download URL | urlquick-2.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7098da91dd0f4dd3fb9a5678f57ab587790f4175e220e74f10744cb2bd9a92a0
|
|
BLAKE2b-256 checksum How to use checksums |
c7099dab8b3fab72780bab582c16d9f81a45c9d2de465cc7db5a4932df6afb4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Security for urlquick 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.