Giter VIP home page Giter VIP logo

chinacapi's Introduction

ChinacApi 星界链API

pypi support-version license
commit

星界链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))  # 关闭云手机

更新日志

chinacapi's People

Contributors

akagiyui avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.