Skip to main content

A Python package for sprotect cloud compute

Project description

快速开始

1. 初始化云计算对象

from sp.sp 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.3.tar.gz (10.4 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.3-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spcloud-0.1.3.tar.gz
  • Upload date:
  • Size: 10.4 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.3.tar.gz
Algorithm Hash digest
SHA256 3b649e719538d4777a56de3555b4fd2f8c81647140647ff48199175052bb09e4
MD5 347188015313ffceee2580eab21cd101
BLAKE2b-256 877861e85f9104f3e8b59772cc9c9d855883a5ec00df4f08c5f22845d9719c74

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spcloud-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.3 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d0eb7c5b2da79d6c22239e14bc6f2a2305a3471e5888a3ebbd643ff968f418ad
MD5 5d21fc5d464ad1d0ed6c6bcb15cf4ea9
BLAKE2b-256 fb3133e48070055ab2a0cd906a0bda577dec9e16aef1a82a8ba92d091dd80794

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