Skip to main content

A Python package for sprotect cloud compute

Project description

快速开始

1. 初始化云计算对象

from sp.spclass import SPCloud
from ctypes import c_bool

cloud = SPCloud(SP的dll目录)
cloud.cloud_create()

2. 设置连接信息

cloud.cloud_set_conninfo(
    software_name='YourSoftwareName',
    ip='服务器IP或域名',
    port=端口号,                 # 例如 8896
    timeout=超时时间秒,           # 例如 300
    localversion=本地版本号,       # 例如 1
    pop_out=c_bool(False)        # 是否弹窗
)

3. 卡密登录 或 账号登录

卡密登录:

login_result = cloud.card_login('你的卡密')
print(login_result)  # {'ret': True/False, 'code': 错误码}

账号登录:

login_result = cloud.user_login('账号', '密码')
print(login_result)

4. 常用接口举例

获取卡密代理名

agent = cloud.cloud_get_card_agent()
print(agent)

获取卡密类型

card_type = cloud.cloud_get_card_type()
print(card_type)

获取卡密IP地址

ip_info = cloud.cloud_get_ip_address()
print(ip_info)

获取公告内容

notices = cloud.cloud_get_notices()
print(notices)

获取点数

fyi = cloud.cloud_get_fyi()
print(fyi)

扣除点数

deduct_result = cloud.cloud_deduct_fyi(点数数量)
print(deduct_result)

5. 下线与销毁对象

cloud.cloud_offline()
cloud.cloud_destroy()

其他接口说明

SPCloud 封装了大部分云计算常用接口,包括:

  • 用户注册、充值、改密码
  • 查询/解绑机器码
  • 查询在线信息、踢用户下线
  • 获取/申请试用卡
  • 获取/禁用当前卡密
  • 获取/设置本地版本号、客户端ID等
  • 错误码查询(cloud_get_error_msg

每个方法均有 docstring,参数类型、返回值及异常说明可参见源码。

错误处理

所有调用如未登录、未初始化等,均会抛出异常或返回 {'ret': False, 'code': 错误码} 格式。可通过 cloud.cloud_get_error_msg(错误码) 获取详细错误信息。

示例代码

sp/spclass.py 文件末尾的 if __name__ == '__main__': 区块,包含了完整的调用演示。

常见问题

  • Q1: DLL 加载失败?
    • 请确保 SPCloud64_Py.dllSProtectSDK64.dll 目录正确,且操作系统为 Windows。
  • Q2: 字符串参数乱码?
    • 所有字符串参数均按 gbk 编码传递,返回值解码同样如此。

许可证

本仓库仅供学习和内部集成测试使用。如需商业或大规模场景使用,请联系原作者或官方获取授权。


如有疑问或 bug,欢迎提 issue 或联系作者。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spcloud-0.1.1.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spcloud-0.1.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file spcloud-0.1.1.tar.gz.

File metadata

  • Download URL: spcloud-0.1.1.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for spcloud-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ab9e77d7f90e0c3d51ebbbea71683734245b3b0b67f86a95b8e176086fb20242
MD5 d2ce140e9e4e875bb37584a587f84a84
BLAKE2b-256 703eaa769d75189cf2d798ea6c9d0f2e4014fe62b5f485fc19e1703c1f781532

See more details on using hashes here.

File details

Details for the file spcloud-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: spcloud-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for spcloud-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8245de020c87ad01292f2b67d9b37fce380628a8a411dcbe64951d2811218944
MD5 74bbfc7a8eebe459b02e179790b5668a
BLAKE2b-256 a8dad0ca9dc2bd7e07ade38063e7c597a4300f041dd087b367786e775b47ee1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page