✨ 一个现代化的爱发电 Python SDK ✨
✨ 同时支持 同步 与 异步 调用 ✨
安装方式
pip install afdiankit
# or, use poetry
poetry add afdiankit
# or, use pdm
pdm add afdiankit
使用方法
使用爱发电网页端 API
获取网页端 auth_token
在爱发电网页端打开 F12 开发者工具,切换到 Console(控制台)标签页,输入以下 JavaScript 代码获取网页端 auth token
document.cookie.match(new RegExp("(^| )auth_token=([^;]+)"))[2];
调用 afdiankit 示例:
from afdiankit import Afdian, TokenAuthStrategy
afdian = Afdian("<auth_token>")
# 或者显式调用 TokenAuthStrategy
github = Afdian(TokenAuthStrategy("<auth_token>"))
使用开放平台 API
在开发者后台生成 webhook 的 token,复制 user_id。
调用 afdiankit 示例:
from afdiankit import Afdian, TokenAuthStrategy
afdian = Afdian()
user_id = "<user_id>"
token = "<token>"
afdian.open.post_ping(
token=token,
user_id=user_id,
params={"a": "1"},
ts=int(time.time())
).json()
许可证
项目源代码使用 MIT 许可证授权,见 LICENSE。
鸣谢
Metadata
Release files for afdiankit 0.2.0
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 |
|---|---|---|---|---|
| afdiankit-0.2.0.tar.gz | 24.3 kB | Without provenance | Details for afdiankit-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| afdiankit-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for afdiankit-0.2.0-py3-none-any.whl |
Total release size: 65.1 kB
Release files / afdiankit-0.2.0.tar.gz
| Download URL | afdiankit-0.2.0.tar.gz |
|---|---|
| Size | 24.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a570111dab24fa2066caea5ee2c9896fa1a7eaea3600cb8eb7f885b3c5bd5e64
|
|
BLAKE2b-256 checksum How to use checksums |
af16509406fbdc07911096a5965c8c6fdfedcc826cd1c8b212ab658a0641ccea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / afdiankit-0.2.0-py3-none-any.whl
| Download URL | afdiankit-0.2.0-py3-none-any.whl |
|---|---|
| Size | 40.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e580b89dd966c9826d5e6cd2c1a11314cc626834cd4f8961ffa533950aee953b
|
|
BLAKE2b-256 checksum How to use checksums |
b2a96175031a83d5b71d7010302e407de77ab1a15c2bafd287711afb0dc560b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Security for afdiankit 0.2.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.