{ "info": { "author": "Piksel", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ".. image:: https://pikselgroup.com/broadcast/wp-content/uploads/sites/3/2017/09/P-P.png\n :target: https://piksel.com/product/piksel-palette/\n :align: center\n :alt: Piksel Palette\n\n#########################\nPython Sequoia Client SDK\n#########################\nA Python Client SDK for interacting with client services.\n\nThe central idea is that Client SDK allows python application code to communicate with the `Piksel Palette`_ RESTful RESTful services.\nUsers can also search, filter and select their response collections.\n\n.. _Piksel Palette: http://developer.pikselpalette.com/\n\n************\nInstallation\n************\n\n.. code-block:: bash\n\n pip install sequoia-client-sdk\n\n\n*****\nUsage\n*****\n\n\nCreating a SequoiaClient\n========================\nThe Sequoia RESTful services have an OAuth token-based authorisation model, meaning that the Client SDK must first\nacquire a time-limited access token before making further requests.\n\nTo create the client it is needed to provide credentials and the url for the service ``registry``:\n\n .. code-block:: python\n\n client = Client(\"https://registry-sandbox.sequoia.piksel.com/services/testmock\",\n grant_client_id=\"clientId\",\n grant_client_secret=\"clientSecret\")\n\n\nAuthentication types\n====================\n\nWhen creating the client, authentication type can be specified using the parameter ``auth_type``:\n\n .. code-block:: python\n\n client = Client(\"https://registry-sandbox.sequoia.piksel.com/services/testmock\",\n auth_type=AuthType.CLIENT_GRANT,\n grant_client_id=\"clientId\",\n grant_client_secret=\"clientSecret\")\n\nThere are three authentication types:\n\nCLIENT_GRANT type\n-----------------\n\nThis is the default type. With CLIENT_GRANT mode ``grant_client_id`` and ``grant_client_secret`` parameters are\nused to get an access token. The access token is refreshed automatically when expired. Optionally, ``byo_token``\nparameter can be provided when instantiating the client, and will be used until it is expired.\nThen the access token is refreshed automatically.\n\n\nBYO_TOKEN type\n--------------\n\nWith this method ``byo_token`` is required. That access token will be used to authenticate requests. The access token will\nbe used along the client life and won't be refreshed.\n\nNO_AUTH type\n------------\n\nMode used when no authentication is required.\n\n\nCreating an endpoint\n====================\n\nAn endpoint defines the resource on which to perform the operations.\n\n .. code-block:: python\n\n profile_endpoint = client.workflow.profiles\n content_endpoint = client.metadata.contents\n\n\nAPI methods\n===========\n\nRead\n----\n\nRetrieves one resource given its reference and owner and returns the response retrieved.\n\n .. code-block:: python\n\n endpoint.read(owner, ref)\n\n\nBrowse\n------\n\nRetrieves the list of resources that matches with the criteria and returns the response.\n\n .. code-block:: python\n\n endpoint.browse(owner, criteria)\n\nStore\n-----\n\nCreates one or more resources and returns the response retrieved.\n\n .. code-block:: python\n\n endpoint.store(owner, json)\n\n\nCriteria API for Requesting Data\n================================\n\nThe SDK supports a fluent criteria API to abstract client code from\nthe details of the Sequoia query syntax:\n\n .. code-block:: python\n\n endpoint.browse(\"testmock\", Criteria().add(\n StringExpressionFactory.field(\"contentRef\").equal_to(\"testmock:sampleContent\")))\n\nThe following filtering criteria are supported:\n\nequalTo\n-------\n .. code-block:: python\n\n StringExpressionFactory.field(\"engine\").equal_to(\"diesel\")\n\nWill generate the criteria expression equivalent to: field=diesel (withEngine=diesel)\n\nInclusion of related documents\n------------------------------\n\nThe SDK support inclusion of related documents up to 1 level (direct relationships).\n\nBoth, direct and indirect relationships, are allowed. In each case resource's *reference* are needed to perform the mapping.\n\n .. code-block:: python\n\n Criteria().add(inclusion=Inclusion.resource('assets'))\n\nSelecting fields\n----------------\n\nThe SDK allows to specify which fields will be present in the response, discarding the rest of them.\n\nFor now it can be used only for Inclusions\n\n .. code-block:: python\n\n Criteria().add(inclusion=Inclusion.resource('assets').fields('name','ref'))\n\n\n\nPaginating results\n==================\n\nIterator\n--------\n\nBrowse responses can be paginated. To paginate results, browse response has to be used as an iterator.\n\n .. code-block:: python\n\n for response in endpoint.browse('testmock'):\n resources = response.resources\n\nNot iterator\n------------\n\nIf browse function is not used as an iterator, only first page is retrieved. i.e:\n\n .. code-block:: python\n\n response = endpoint.browse('testmock')\n resources_in_page_1 = response.resources\n\n\nWith continue\n-------------\n\nSequoia services allow to paginate using the parameter `continue`, which will return the link to get the following page in the `meta` of the response.\nThe `browse` can be call repeatedly while there are pages to be read.\nOptionally, you can set the number of items per page.\n\n .. code-block:: python\n\n for response in endpoint.browse('testmock', query_string='continue=true&perPage=2'):\n resources = response.resources\n\n\nPaginating linked resources\n===========================\n\nInclusion\n---------\n\nWhen doing an inclusion, service returns a list of linked resources. Those resources can be paginated. Let's assume a browse of contents is performed with assets resource as an inclusion. To perform pagination:\n\n .. code-block:: python\n\n for linked_assets in endpoint.browse('testmock').linked('assets'):\n for linked_asset in linked_assets:\n asset_name = linked_asset['name']\n\nIf linked response is not used as an iterator, only first page of linked resources is retrieved:\n\n .. code-block:: python\n\n linked_assets = endpoint.browse('testmock').linked('assets')\n for linked_asset in linked_assets.resources:\n asset_name = linked_asset['name']\n\n\n\nRetrying requests\n=================\nWhen a request is returning a retrievable status code, a retry strategy can be configured with ``backoff_strategy``. By default ``backoff_strategy`` is\n\n .. code-block:: python\n\n {'wait_gen': backoff.constant, 'interval': 0, 'max_tries': 10}\n\nWe can set a different backoff strategy.\n\n .. code-block:: python\n\n client = Client(\"https://registry-sandbox.sequoia.piksel.com/services/testmock\",\n grant_client_id=\"clientId\",\n grant_client_secret=\"clientSecret\",\n backoff_strategy={'wait_gen': backoff.expo, 'base':2, 'factor': 1, 'max_tries': 5, 'max_time': 300}\n )\n\nHere an exponential strategy will be used, with a base of 2 and factor 1.\n\nFor more info about backoff strategies https://github.com/litl/backoff\n\n***********\nDevelopment\n***********\n\nIt has been tested for Python 3.5 and 3.6\n\nYou can use the included command line tool `make `_ to work with this project\n\nPreparing environment\n=====================\n\nCreate new virtualenv\n---------------------\n\nIt's encouraging to create a new virtual environment and install all the dependencies in it.\nYou can use these commands:\n\n.. code-block:: python\n\n mkdir -p ~/.virtualenvs\n virtualenv -p python3.6 ~/.virtualenvs/sequoia-python-client-sdk\n workon sequoia-python-client-sdk\n pip install -r requirements.txt\n pip install -r requirements_test.txt\n\n\n\nTesting\n=======\n\nThere are two different ways of running the tests.\n\nRun tests on the current environment\n------------------------------------\n\nUsing ``pytest`` option will run all the unit tests over your environment.\n\n.. code-block:: python\n\n make test\n\nRun tests on every compatible python version\n--------------------------------------------\n\nWhile using the option ``test`` will set up a virtual environment for the supported version of Python, i.e. 3.5 and 3.6 and will run all the tests on each of them.\n\n.. code-block:: python\n\n make test-all\n\nLint\n----\n\nTo make sure the code fulfills the format run\n\n.. code-block:: python\n\n make lint\n\n\n\n=======\nHistory\n=======\n\n1.0.0\n------------------\n\n* First release.\n\n\n1.1.0 (2017-10-25)\n------------------\n\n* Upgrade to Python 3.6\n\n\n1.2.0 (2019-03-06)\n------------------\n\n* Libraries `urllib3` and `requests` upgraded to solve security issues:\n - `CVE-2018-20060 `_\n - `CVE-2018-18074 `_\n\n1.2.1 (2019-03-26)\n------------------\n\n* Load yaml config file for testing in a safer way as specified in `PyYAML `_\n\n2.0.0 (2019-06-06)\n------------------\n\n* Removing python 2.7 compatibility\n\n* Adding backoff to http requests. Configurable backoff from client creation\n\n* Libraries `urllib3` and `requests` upgraded to solve security issues\n\n2.1.0 (2019-09-30)\n------------------\n\n* Modifying setup.cfg to allow different version formats (i.e development versions)\n* Paging with `continue` parameter\n* When token is expired, it is updated automatically with CLIENT_GRANT auth type\n\n2.1.1 (2019-10-02)\n------------------\n* Token fetching not restarting backoff. Retries continuing its count instead of restarting it when there is a invalid token\n\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "https://github.com/pikselpalette/sequoia-python-client-sdk", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pikselpalette/sequoia-python-client-sdk", "keywords": "python", "license": "Apache", "maintainer": "Piksel", "maintainer_email": "", "name": "sequoia-client-sdk", "package_url": "https://pypi.org/project/sequoia-client-sdk/", "platform": "", "project_url": "https://pypi.org/project/sequoia-client-sdk/", "project_urls": { "Download": "https://github.com/pikselpalette/sequoia-python-client-sdk", "Homepage": "https://github.com/pikselpalette/sequoia-python-client-sdk" }, "release_url": "https://pypi.org/project/sequoia-client-sdk/2.1.1/", "requires_dist": [ "astroid (==1.6.5)", "backoff (==1.8.*)", "chardet (==3.0.*)", "enum34 (==1.1.*)", "idna (==2.*)", "requests (==2.22.*)", "requests-oauthlib (==1.2.*)", "urllib3 (==1.25.*)" ], "requires_python": "", "summary": "Sequoia Python Client SDK", "version": "2.1.1" }, "last_serial": 5916742, "releases": { "1.1.0": [ { "comment_text": "", "digests": { "md5": "6eb5ef4ed286ca4bb5d84216089e6507", "sha256": "9b5b7e62bcffb7b66997adc8eafbcd938ab28426c235fb10302b91dd4d9433ce" }, "downloads": -1, "filename": "sequoia_client_sdk-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6eb5ef4ed286ca4bb5d84216089e6507", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18163, "upload_time": "2019-02-27T17:55:32", "url": "https://files.pythonhosted.org/packages/bb/33/2c5ecc8103a39dd8e0d2ab5715829ef465bf850a6dcbdd8f487c793160ef/sequoia_client_sdk-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f2e119290784822ea51d59d2720257b2", "sha256": "83486f1e2937be75ac988562a03374c2e1ad670989792e01a98aafd476e60a2a" }, "downloads": -1, "filename": "sequoia-client-sdk-1.1.0.tar.gz", "has_sig": false, "md5_digest": "f2e119290784822ea51d59d2720257b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 148275, "upload_time": "2019-02-27T17:55:34", "url": "https://files.pythonhosted.org/packages/8d/bf/d633558f6ee2801088e9726fbe82bd03de809016beb8850d773e6047ea84/sequoia-client-sdk-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "60cb83d49a0cfc7234c137a3e9d951e2", "sha256": "ef53b4ec586adebd38a537b69f30cf9684db1b7680e8d772ea18bcbfb97c25de" }, "downloads": -1, "filename": "sequoia_client_sdk-1.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "60cb83d49a0cfc7234c137a3e9d951e2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18387, "upload_time": "2019-03-06T16:35:57", "url": "https://files.pythonhosted.org/packages/eb/7a/39522df6e666259211090c6e1378b1f3f06a2edcb91a26a18fb624208d01/sequoia_client_sdk-1.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "abc4d341397fbc1d0d0aa6d923b61014", "sha256": "2d7788ae59dde7b4cad355fcf268de7c2e7489ff6d4be862a5949ed105bdfa95" }, "downloads": -1, "filename": "sequoia-client-sdk-1.2.0.tar.gz", "has_sig": false, "md5_digest": "abc4d341397fbc1d0d0aa6d923b61014", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 148294, "upload_time": "2019-03-06T16:35:58", "url": "https://files.pythonhosted.org/packages/ed/f2/d770ed064831787d628fe931df6229e3aca0f4d63870e4f5540621477930/sequoia-client-sdk-1.2.0.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "2d2823148ff45883b392b54dc034ea21", "sha256": "6bc1fa59e5b770c19ad919a40adee244c682452ddb83a5412789e6e9f215a276" }, "downloads": -1, "filename": "sequoia_client_sdk-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2d2823148ff45883b392b54dc034ea21", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 19014, "upload_time": "2019-06-06T08:33:25", "url": "https://files.pythonhosted.org/packages/46/c5/f52ccb742be67de917cbc5dd29cf73278eee93a5ce916f721a0ededfc165/sequoia_client_sdk-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "30214a041070cbe728395a3a1ede9119", "sha256": "dc94b668990a0e222e6820df9877900d34bc1cdfad2fe4125e44a730eb131ffd" }, "downloads": -1, "filename": "sequoia-client-sdk-2.0.0.tar.gz", "has_sig": false, "md5_digest": "30214a041070cbe728395a3a1ede9119", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 148121, "upload_time": "2019-06-06T08:33:27", "url": "https://files.pythonhosted.org/packages/8f/0a/71100d7383595c41517cc2b7b563c9ca749a032487dc74eac2c1f0c7101c/sequoia-client-sdk-2.0.0.tar.gz" } ], "2.1.0": [ { "comment_text": "", "digests": { "md5": "5371deba5e21e62f7bb542a65dbd0582", "sha256": "5a0d5d892a5bd86b19abac174ce8e3166c48ac0dd9310afde85fe4ff6bd13879" }, "downloads": -1, "filename": "sequoia_client_sdk-2.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5371deba5e21e62f7bb542a65dbd0582", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 20534, "upload_time": "2019-10-01T06:34:44", "url": "https://files.pythonhosted.org/packages/b6/2d/7c4123d89b02a6c7c32df163dcd2badeed6c6dcc925f6c0e99a8b7769745/sequoia_client_sdk-2.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "be9998c3028dc5af6900bca2ed61977b", "sha256": "6a265e47bc4cd3f35bb30e646a76952c4627799b6a7dc7469bb380f6d6995d3e" }, "downloads": -1, "filename": "sequoia-client-sdk-2.1.0.tar.gz", "has_sig": false, "md5_digest": "be9998c3028dc5af6900bca2ed61977b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 153358, "upload_time": "2019-10-01T06:34:46", "url": "https://files.pythonhosted.org/packages/7f/54/08e4f56aab789e6b6fc76009f3d1ed076514d0835cecc669051a5cbd8be9/sequoia-client-sdk-2.1.0.tar.gz" } ], "2.1.1": [ { "comment_text": "", "digests": { "md5": "2f441eb21cd640bf7a6a393dd2d3bd10", "sha256": "597addb5ec620955bdbb59bba1cfafd0745ac9cfb4ba4e617263f4ca11960ec3" }, "downloads": -1, "filename": "sequoia_client_sdk-2.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2f441eb21cd640bf7a6a393dd2d3bd10", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 20600, "upload_time": "2019-10-02T08:22:19", "url": "https://files.pythonhosted.org/packages/75/ed/70fcf8bfebba9b7602732f7b647c45b9433015b46e782341ebd4c5f49845/sequoia_client_sdk-2.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bc00cb20647cbb4cd09fdb07af542383", "sha256": "e98070de953c71140f674ae6fd9d630b84c94562ab90aa40aa84005ff7908b6d" }, "downloads": -1, "filename": "sequoia-client-sdk-2.1.1.tar.gz", "has_sig": false, "md5_digest": "bc00cb20647cbb4cd09fdb07af542383", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 153521, "upload_time": "2019-10-02T08:22:21", "url": "https://files.pythonhosted.org/packages/23/53/12b8f5c3696b6fa4f7ce3eab214d320c6ce3c6288d1c9cde2fcd57d2ff32/sequoia-client-sdk-2.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2f441eb21cd640bf7a6a393dd2d3bd10", "sha256": "597addb5ec620955bdbb59bba1cfafd0745ac9cfb4ba4e617263f4ca11960ec3" }, "downloads": -1, "filename": "sequoia_client_sdk-2.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2f441eb21cd640bf7a6a393dd2d3bd10", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 20600, "upload_time": "2019-10-02T08:22:19", "url": "https://files.pythonhosted.org/packages/75/ed/70fcf8bfebba9b7602732f7b647c45b9433015b46e782341ebd4c5f49845/sequoia_client_sdk-2.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bc00cb20647cbb4cd09fdb07af542383", "sha256": "e98070de953c71140f674ae6fd9d630b84c94562ab90aa40aa84005ff7908b6d" }, "downloads": -1, "filename": "sequoia-client-sdk-2.1.1.tar.gz", "has_sig": false, "md5_digest": "bc00cb20647cbb4cd09fdb07af542383", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 153521, "upload_time": "2019-10-02T08:22:21", "url": "https://files.pythonhosted.org/packages/23/53/12b8f5c3696b6fa4f7ce3eab214d320c6ce3c6288d1c9cde2fcd57d2ff32/sequoia-client-sdk-2.1.1.tar.gz" } ] }