Commercetools SDK
项目描述
这是Commercetools平台的非官方Python SDK。它仅支持Python 3.6+,并使用类型注解以提高开发体验。
API使用commercetools api RAML文件生成,并使用marshmallow进行序列化和反序列化。
安装
pip安装commercetools
示例
from commercetools.platform import Client
client = Client(
client_id="<your-client-id>",
client_secret="<your-client-secret>",
scope=["<scopes>"],
url="https://api.europe-west1.gcp.commercetools.com",
token_url="https://auth.europe-west1.gcp.commercetools.com",
)
product = (
client
.with_project_key("<your-project-key>")
.products()
.with_id("00633d11-c5bb-434e-b132-73f7e130b4e3")
.get())
print(product)
客户端还可以通过设置以下环境变量进行配置
export CTP_CLIENT_SECRET="<client secret>"
export CTP_CLIENT_ID="<client id>"
export CTP_AUTH_URL="https://api.europe-west1.gcp.commercetools.com"
export CTP_API_URL="https://auth.europe-west1.gcp.commercetools.com"
export CTP_SCOPES="<comma seperated list of scopes>"
然后构建一个不带参数的客户端
from commercetools.platform import Client
client = Client()
product = (
client
.with_project_key("<your-project-key>")
.products()
.with_id("00633d11-c5bb-434e-b132-73f7e130b4e3")
.get())
print(product)
发布
首先(pip)安装bump2version并更新CHANGES文件。然后更新版本(根据更改,可以是主要版本/次要版本/补丁版本)
bumpversion --tag <major,minor,patch>
bumpversion是原始的,因为它进行字符串替换,所以进行一次检查,确保它没有意外更新Pypi依赖项。如果没有,则推送代码
git push --follow-tags
我们使用GitHub actions,所以请确保构建成功,然后转到标签标签页(https://github.com/labd/commercetools-python-sdk/tags)。
点击点以触发发布操作。将变更日志项目复制到发布描述中,并输入发布版本。这将上传发布到PyPi。
项目详情
关闭
commercetools-2023.6.29.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 8e9a15429c69a47a6fddcf6e12868dca021c4a6646954ef2670d097486860ef6 |
|
MD5 | 208e3bded1881e326c81d814fc294a5a |
|
BLAKE2b-256 | 00f83791fb5c044eee953741642040cb445838b8ad4171b44bce59b3a176842a |
关闭
commercetools-2023.6.29-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 862b9f23d69cc1515f4f5cc0c29bbff1377bec2e38f59b18c8cd7fc9b689adda |
|
MD5 | 1ed8c1b6e6880fac9854685496400971 |
|
BLAKE2b-256 | 5388f91d5df20edfcc5c754d9dc1e172aa196ce4764ff481246ee1e739037fc3 |