SDK for Commercetools
Project description
This is an unofficial Python SDK for the Commercetools platform. It only supports Python 3.6+ and uses type annotation for an improved development experience.
The API is mostly generated using the commercetools api RAML file and uses the attr library for the dataobjects and marshmallow for the serialization and deserialization steps.
Installation
pip install commercetools
Example
from commercetools import Client
client = Client(
project_key="<your-project-key>",
client_id="<your-client-id>",
client_secret="<your-client-secret>",
scope=["<scopes>"],
url="https://api.sphere.io",
token_url="https://auth.sphere.io/oauth/token",
)
product = client.products.get_by_id("00633d11-c5bb-434e-b132-73f7e130b4e3")
print(product)
The client can also be configured by setting the following environment variables:
export CTP_PROJECT_KEY="<project key>"
export CTP_CLIENT_SECRET="<client secret>"
export CTP_CLIENT_ID="<client id>"
export CTP_AUTH_URL="https://auth.sphere.io"
export CTP_API_URL="https://api.sphere.io"
export CTP_SCOPES="<comma seperated list of scopes>"
And then constructing a client without arguments:
from commercetools import Client
client = Client()
product = client.products.get_by_id("00633d11-c5bb-434e-b132-73f7e130b4e3")
print(product)
Releasing
To release this package first (pip) install bumpversion and update the CHANGES file. Then update the version (either major/minor/patch depending on the change)
bumpversion --tag <major,minor,patch>
bumpversion is naive because it string replaces, so do a sanity check it didn’t accidentally update a Pypi dependency. If not, push the code:
git push --follow-tags
Then go to Azure Pipelines and wait for the build to create an artifact. Once the build succeeded go to Releases and create a release with the correct artifact. This will release the package to Pypi.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file commercetools-4.1.0.tar.gz
.
File metadata
- Download URL: commercetools-4.1.0.tar.gz
- Upload date:
- Size: 205.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/2.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b28cc4ebc08fc1a7b39b2cc57fd39ebab858d8f339bd4ac914db1a28b8722420 |
|
MD5 | 700061de129c31aff318d081d54e55ba |
|
BLAKE2b-256 | 16996c6d19c445597e8f661d9836c970bd1e2c306467fc02faea72752c732fbe |
Provenance
File details
Details for the file commercetools-4.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: commercetools-4.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 278.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/2.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bcda9d009cd40d0de729b827f3e25445c6e96400bca03f88119ee5bcbc77f8a |
|
MD5 | 7279c09bc22f5ab6d0eecb5a7a27528b |
|
BLAKE2b-256 | 4d6cd4bed58f44f290b42e266fa133d4440e2338a59eb803fcaaa7af9fa20c68 |