Files
pillar-python-sdk/README.md
Sybren A. Stüvel 0fd043ecb8 Support session objects.
This not only improves general performance by sharing socket connections
between HTTP calls, but also allows for caching with Requests-Cache.
2016-03-18 12:41:24 +01:00

810 B

Pillar Python REST SDK

Integrate this module in your Python app to communicate with an Pillar server.

Caching

Requests-Cache can be used to cache HTTP requests. The Pillar Python REST SDK does not support it directly, but provides the means to plug in different session objects:

import requests_cache
import pillarsdk

req_sess = requests_cache.CachedSession(backend='sqlite',
                                        cache_name='blender_cloud')
pillarsdk.Api.requests_session = req_sess

Any pillarsdk.Api instance will now use the cached session. To temporary disable it, use:

api = pillarsdk.Api.Default(endpoint="https://your.endpoint")
with api.requests_session.cache_disabled():
    node = pillarsdk.Node.find('1234')