Sybren A. Stüvel c8eec9fa9d Added pickle support for Resource classes, albeit a bit hacky.
Unpickling requires the class to be known, so we can't simply use to_dict()
to pickle and pass the dict to __init__() to unpickle. This works for the
pickled object itself (as pickle restores its type), but fails to restore
the class of subobjects, such as some_node.picture. This is why the code
now pickles each subobject too.
2017-09-19 13:43:48 +02:00
2017-03-03 12:23:45 +01:00
2015-08-31 19:25:01 +02:00
2017-03-03 12:23:45 +01:00

Pillar Python REST SDK

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

Supports Python 3.5 and 3.6. Currently also supports Python 2.7, but support will be ending soon.

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')
Description
Pillar-python-sdk
Readme 225 KiB
Languages
Python 99.4%
Shell 0.6%