网易考拉 Python SDK
目前只支持1.0版本的接口
安装
pip install kaola
使用方法
获取access_token
- 首先在考拉开放平台注册账号,注册通过后创建应用,给应用起个名字,获取到appkey和appsecret。
- 使用generate_authorization_code_url方法获取获取access code的url,然后访问这个url,用户授权后会自动跳转参数中的redirect_url
kaola = KaoLa(appkey, appsecret) kaola.generate_authorization_code_url(redirect_url)
- 在redirect_url的响应事件中先验证state的合法性:
kaola.check_authorization_state(redirect_url, state)
- 第3步获取到的code,使用get_access_token方法获取token
kaola.get_access_token(code, shop.redirect_url)
调用API
获取到access_token后,传给初始化函数,或使用set_token方法设置到已有KaoLa实例中。
from kaola.api.kaola import KaoLa
kl = KaoLa("edb6c3b9ac4847e7584c38e2b630b14f", "8200ee92ec22fcae76e2f00bc5c79247188e0593",access_token="bff74ff8-bbec-4699-bc4c-529801aefcb4", sandbox=True)
# 搜索订单
kl.order.search_order(
1, 1, "2019-01-01 0:00:00", "2019-01-30 23:59:59").json()
sandbox 是否是沙箱环境
changelog
- [0.0.8] 修复订单详细信息查询接口
- [0.0.3] 修复返回结果格式问题
- [0.0.4] 更新access token获取机制
- [0.0.5] 更新说明
- [0.0.6] 接口返回数据直接返回内层数据
Metadata
Release files for kaola 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kaola-0.0.9.tar.gz | 9.1 kB | Without provenance | Details for kaola-0.0.9.tar.gz |
Release files / kaola-0.0.9.tar.gz
| Download URL | kaola-0.0.9.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
92a2dacc11593f37e3248c704d826e525d5445e35953e0f82ebf97bef9ef2885
|
|
BLAKE2b-256 checksum How to use checksums |
d9fa2e339465fffa021fd69014b38381fd0fe44c72a5a8b3cfd8be7af1f702fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.7
|
Security for kaola 0.0.9
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.