Sequoia Python Client SDK
Python Sequoia Client SDK
A Python Client SDK for interacting with client services.
The central idea is that Client SDK allows python application code to communicate with the Piksel Palette RESTful RESTful services. Users can also search, filter and select their response collections.
pip install sequoia-client-sdk
Creating a SequoiaClient
The Sequoia RESTful services have an OAuth token-based authorisation model, meaning that the Client SDK must first acquire a time-limited access token before making further requests.
To create the client it is needed to provide credentials and the url for the service registry:
client = Client("https://registry-sandbox.sequoia.piksel.com/services/testmock", grant_client_id="clientId", grant_client_secret="clientSecret")
Creating an endpoint
An endpoint defines the resource on which to perform the operations.
profile_endpoint = client.workflow.profiles content_endpoint = client.metadata.contents
Retrieves one resource given its reference and owner and returns the response retrieved.
Retrieves the list of resources that matches with the criteria and returns the response.
Creates one or more resources and returns the response retrieved.
Criteria API for Requesting Data
The SDK supports a fluent criteria API to abstract client code from the details of the Sequoia query syntax:
endpoint.browse("testmock", Criteria().add( StringExpressionFactory.field("contentRef").equal_to("testmock:sampleContent")))
The following filtering criteria are supported:
Will generate the criteria expression equivalent to: field=diesel (withEngine=diesel)
The SDK allows to specify which fields will be present in the response, discarding the rest of them.
For now it can be used only for Inclusions
Browse responses can be paginated. To paginate results, browse response has to be used as an iterator.
for response in endpoint.browse('testmock'): resources = response.resources
If browse function is not used as an iterator, only first page is retrieved. i.e:
response = endpoint.browse('testmock') resources_in_page_1 = response.resources
It has been tested for Python 2.7, 3.5 and 3.6
You can use the included command line tool make to work with this project
Create new virtualenv
It’s encouraging to create a new virtual environment and install all the dependencies in it. You can use these commands:
mkdir -p ~/.virtualenvs virtualenv -p python3.6 ~/.virtualenvs/sequoia-python-client-sdk workon sequoia-python-client-sdk pip install -r requirements.txt pip install -r requirements_test.txt
There are two different ways of running the tests.
Run tests on the current environment
Using pytest option will run all the unit tests over your environment.
Run tests on every compatible python version
While using the option test will set up a virtual environment for the supported version of Python, i.e. 2.7, 3.5 and 3.6 and will run all the tests on each of them.
To make sure the code fulfills the format run
- First release.
- Upgrade to Python 3.6
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|
|sequoia_client_sdk-1.2.0-py2.py3-none-any.whl (18.4 kB) Copy SHA256 hash SHA256||Wheel||py2.py3|
|sequoia-client-sdk-1.2.0.tar.gz (148.3 kB) Copy SHA256 hash SHA256||Source||None|