跳转到主要内容

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。

项目详情


发布历史 发布通知 | RSS源

下载文件

下载适合您平台的文件。如果您不确定该选择哪个,请了解有关安装包的更多信息。

源分发

commercetools-2023.6.29.tar.gz (615.4 kB 查看哈希值)

上传时间

构建分发

commercetools-2023.6.29-py3-none-any.whl (1.1 MB 查看哈希值)

上传时间 Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面