ChinacApi 星界链API
星界链OpenApi Python SDK
支持
- 获取云手机列表
- 获取云手机详情
- 重启云手机
- 开启/关闭云手机
- 获取云手机ADB白名单IP列表
- 设置云手机ADB白名单IP
- 获取本机在星界链的公网IP
安装
pip install chinacapi -i https://pypi.tuna.tsinghua.edu.cn/simple
使用
你需要先在星界链控制台申请访问密钥。
from chinacapi.cloud_phone_region import CloudPhoneRegion
from chinacapi.entity.cloud_phone import CloudPhone
from chinacapi.chinac_api import ChinacApi
# 创建 ChinacApi 实例
ca = ChinacApi('your_access_key', 'your_access_secret')
cpa = ca.cloud_phone_api # 云手机API
# 列出所有云手机
cpl = cpa.list_cloud_phone()
for cp in cpl:
print(cp)
# 通过ID构造云手机对象
cp = CloudPhone({
'id': 'cp-xxxxxxxxxxxxxx',
'region': CloudPhoneRegion.SZ,
})
# 获取云手机详情
print(cpa.describe_cloud_phone(cp.region, cp.id))
# 列出云手机ADB白名单
ips = cpa.list_cloud_phone_adb_white_ip(CloudPhoneRegion.SZ)
print(ips)
# 获取本机在星界链的公网IP
my_ip = ChinacApi.get_request_ip()
print(my_ip)
# 设置云手机ADB白名单
print(cpa.set_cloud_phone_adb_white_ip(CloudPhoneRegion.SZ, list(set(ips + my_ip))))
ips = cpa.list_cloud_phone_adb_white_ip(CloudPhoneRegion.SZ)
print(ips)
print(cpa.reboot_cloud_phone(cp)) # 重启云手机
print(cpa.start_cloud_phone(cp)) # 开启云手机
print(cpa.stop_cloud_phone(cp)) # 关闭云手机
Metadata
Release files for chinacapi 0.1.3
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 |
|---|---|---|---|---|
| chinacapi-0.1.3.tar.gz | 6.7 kB | Without provenance | Details for chinacapi-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chinacapi-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for chinacapi-0.1.3-py3-none-any.whl |
Total release size: 15.6 kB
Release files / chinacapi-0.1.3.tar.gz
| Download URL | chinacapi-0.1.3.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f54451b1a5515930eaa753b9ab69e5b5cda8d103b462517a0a5be0ae5d11363d
|
|
BLAKE2b-256 checksum How to use checksums |
3ac08cc8cdcb2b7696d1eefa52b44160c955f3645473dd502889c64be883af70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.9
|
Release files / chinacapi-0.1.3-py3-none-any.whl
| Download URL | chinacapi-0.1.3-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db84c2caa97ff41f3add3f02988424e4521cc06cd89c7c839b9ea781516e2b5b
|
|
BLAKE2b-256 checksum How to use checksums |
306034eaeef15ae42ce55a774a87216725c9ebc32200b5f94ed14e78de4001f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.9
|
Security for chinacapi 0.1.3
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.