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.

Advantage over other libraries: Allows different cache timeout policy for each API

Simple example

from portale import PrefixedURLSession

session = PrefixedURLSession('')

get_thing = session.GETRequest('anything?thing={0}', cache_ttl=10)
thing = get_thing('snake')

get_thing_by_name = session.GETRequest('anything?thing={name}', cache_ttl=10)
thing = get_thing_by_name(name='snake')

long_request = session.GETJSONRequest('delay/{n}', cache_ttl=20)
result1 = long_request(n=2)
result2 = long_request(n=2)  # cached response


cache_ttl if not specified in Request initialization, session’s cache_ttl is used as default cache_ttl for all the APIs using same session.

from portale import PrefixedURLSession

session = PrefixedURLSession('', cache_ttl=10)
get_thing = session.GETRequest('anything?thing={0}')
long_request = session.GETJSONRequest('delay/{n}')

Busting cache


Access cache metrics



nosetests -xv

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
portale-0.9.0.tar.gz (2.5 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page