A light-weight http client with requests like interface.Featuring persistent connectionsand caching support.
Project description
Urlquick
A light-weight http client with requests like interface. Featuring persistent connections and caching support. This project was originally created for use by Kodi add-ons, but has grown into something more. I found, that while requests has a very nice interface, there was a noticeable lag when importing the library. The other option available is to use urllib2, but then you loose the benefit of persistent connections that requests have. Hence the reason for this project.
All GET, HEAD and POST requests are cached locally for a period of 4 hours. When the cache expires, conditional headers are added to a new request e.g. “Etag” and “Last-modified”. Then if the server returns a 304 Not-Modified response, the cache is reused, saving having to re-download the content body.
Features
Simple Keep-Alive & Connection Pooling
Sessions with limited Cookie Controls
International Domains and URLs
Automatic Content Decoding
Elegant Key/Value Cookies
Automatic Decompression
Unicode Response Bodies
Basic Authentication
Connection Timeouts
Resource Caching
Install
Run
pip install urlquick
-or-
pip install git+https://github.com/willforde/urlquick.git
Usage
Urlquick is similar to the requests library but it only implements most top level methods like GET, POST and PUT. The Session class is also implemented in a more limited form. The response object is fully comparable with the ‘requests’ response object. # link request object
>>> import urlquick >>> r = urlquick.get('https://api.github.com/events') >>> r.status_code 200 >>> r.headers['content-type'] 'text/html; charset=utf-8' >>> r.encoding 'utf-8' >>> r.content b'[{"repository":{"open_issues":0,"url":"https://github.com/... >>> r.text u'[{"repository":{"open_issues":0,"url":"https://github.com/... >>> r.json() [{u'repository': {u'open_issues': 0, u'url': 'https://github.com/...
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for urlquick-0.9.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 049271871239b06978d65b5b8a00b6518019fb71850e2a2ec6bc2c9e867e343a |
|
MD5 | a56f15ece443d6e6ce8f84f2639ce44d |
|
BLAKE2b-256 | 22e289cfaecb05048c779870b18ac1fc610d56fee67fef82d3ba53a841b4b97f |