百度sdk
安装
pip install baidu-api
文档
# 授权认证
>>> from baidu.client import BaiduClient
>>> client = BaiduClient(app_id=<你的appid>, api_key=<你的apikey>, secret_key=<你的secretkey>)
# 调用接口
>>> from baidu.api import TextCensor
>>> result, detail = TextCensor(client).is_allowed("在线阅读色情小说,在线赌博,枪支弹药购买: https://iqiyi.com")
>>> result == "rejected"
True
使用redis缓存access_token
from redis import Redis
from baidu.session.redisstorage import RedisStorage
redis_client = Redis.from_url("redis://localhost:6379/0")
session_interface = RedisStorage(redis_client, prefix="baiduapi")
baidu_client = BaiduClient(app_id, api_key, secret_key,
session=session_interface)
感谢
- 里面的session是模仿的wechatpy的session
贡献代码
欢迎提交pr, 我一定会尽早地处理. 不用在乎什么格式, 写代码就是勇敢地提交, 上线. 出错了再修改, 回滚就可以了啊.
Metadata
Release files for baidu-api 0.0.2
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 |
|---|---|---|---|---|
| baidu-api-0.0.2.tar.gz | 3.6 kB | Without provenance | Details for baidu-api-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| baidu_api-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for baidu_api-0.0.2-py3-none-any.whl |
Total release size: 9.9 kB
Release files / baidu-api-0.0.2.tar.gz
| Download URL | baidu-api-0.0.2.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b3ab03ebd69a59672e9ab565d34e6b78063309b9cd472b87de5853b06a40200
|
|
BLAKE2b-256 checksum How to use checksums |
73a6070f8e28eb85d76508b04e0e85da6bc17352c53f68da18137a3771e9290a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.4
|
Release files / baidu_api-0.0.2-py3-none-any.whl
| Download URL | baidu_api-0.0.2-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
676d970db29a86bc037e1edaa735e04d8ce3ab2038f773f12a7c6ec75975f5c9
|
|
BLAKE2b-256 checksum How to use checksums |
0079f88498dfdbb1cb1e2bd349d62928a85312568aa970f107c6c1a996e1f58b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.4
|
Security for baidu-api 0.0.2
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.