Requests based HTTP/REST API client with flexible cache support
Project description
Portale is minimalistic requests based HTTP/REST API client.
Advantage over other libraries: Allows different cache timeout policy for each API
Simple example
from portale import PrefixedURLSession
session = PrefixedURLSession('https://httpbin.org/')
get_thing = session.GETRequest('anything?thing={0}', timeout=10)
long_request = session.GETJSONRequest('delay/{n}', timeout=20)
thing = get_thing('snake')
result = long_request(n=2)
result = long_request(n=2) # cached response
Cache
Busting cache
long_request.cache.bust(n=n)
Access cache metrics
print(long_request.cache.metrics)
Tests
nosetests -xv tests.py
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
portale-0.7.1.tar.gz
(2.3 kB
view details)
File details
Details for the file portale-0.7.1.tar.gz
.
File metadata
- Download URL: portale-0.7.1.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9494074c1feffb148fb7c1f83d7f1aa69d30e66f38af51c4e63d729c6fe5879 |
|
MD5 | da07d97ad986bd116fc0d89f15821728 |
|
BLAKE2b-256 | 1c94b5ff09ce5c81f7885959296283812430a4d4f0b466d729060b41726e8cc5 |