Skip to main content

字节跳动 / 抖音小程序 Python SDK

bytedance 1.0.0,支持 Python 3.6 及以上版本。

覆盖小程序服务端基础能力、触达营销、支付、运营、生活服务、垂直行业及其它接口。 保留 ByteDance、code2Session 等已有调用方式。接口契约随包发布,运行时不抓取文档。

安装

pip install bytedance
pip install 'bytedance[redis,crypto]'

使用

from bytedance import ByteDance

app = ByteDance(app_id='tt-appid', app_secret='secret', access_token_type='file')
session = app.code2Session(code='login-code')
print(session.openid)

result = app.basic.log_in.code_2_session(body={'code': 'login-code'})
print(result.data.openid)

app.marketing.subscribe_notification.notify_user_v2(body={
    'msg_id': 'MSG-template-id',
    'open_id': 'openid',
    'data': {'物品名称': '示例'},
})
app.close()

新增接口提供独立方法,统一接受 body、query、headers、files、path_params 字典以及可选 token。 新增模块保留官方完整响应,旧登录方法继续返回扁平 session 对象。 应用级凭证自动缓存,用户、经营和服务商授权凭证显式传入。

完整接口、鉴权类型、迁移及回调接入说明见项目文档:

测试使用离线契约与官方签名向量,不要求真实应用凭证,也不执行交易。

Metadata

Release files for bytedance 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bytedance 1.0.0
File Size Uploaded Provenance Actions
bytedance-1.0.0.tar.gz 50.8 kB Without provenance Details for bytedance-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bytedance 1.0.0
File Interpreter ABI Platform Actions
bytedance-1.0.0-py3-none-any.whl Python 3 none any Details for bytedance-1.0.0-py3-none-any.whl

Total release size: 101.4 kB

Release files / bytedance-1.0.0.tar.gz

Download URL bytedance-1.0.0.tar.gz
Size 50.8 kB
Tags Source
SHA-256 checksum
How to use checksums
66b9ad47ff327f91ecb402e2258a41df2185e98cb69ef43370964e57c7871f3a
BLAKE2b-256 checksum
How to use checksums
6aa467b4e85499c966515bd38f711cda886f01b1442ba6659fb5f496e25a57e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Release files / bytedance-1.0.0-py3-none-any.whl

Download URL bytedance-1.0.0-py3-none-any.whl
Size 50.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f09522ac66754117667e3bbb57f7950398089d34fe938237f522c5484f0ba2b4
BLAKE2b-256 checksum
How to use checksums
9ce6e994d5e8f004fa114f041bbee0c6449232996ca9fbca21868bb7ba2194fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Security for bytedance 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page