Skip to main content

Requests based HTTP/REST API client with flexible cache support

Project description

Portale is minimalistic requests based HTTP/REST API client.

Big advantage it has over other libraries is it also lets you configure cache timeout policy for each of the APIs independently.

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.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file portale-0.7.tar.gz.

File metadata

  • Download URL: portale-0.7.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for portale-0.7.tar.gz
Algorithm Hash digest
SHA256 07e4f878679c2e3966f84b7a48e2821addf421ead2d09afacbd175aec00f3591
MD5 2148a98350ecb6f29be3ee2aa60841c0
BLAKE2b-256 f8589c6bd94522ba0934d9a118f37927398660d637593d62fd16d56e3e55a3b8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page