Skip to main content

A simple socket-based RPC client

Project description

📦 live_studio_open_service

一个轻量级 Python 客户端,用于通过 TCP 协议与LIVE Studio进行交互。


✅ 安装方式

你可以使用 pip 安装(发布到 PyPI 后):

pip install live_studio_open_service

🚀 快速上手

示例一:使用默认地址

from live_studio_open_service import call

result = call("say_hello", ["world"])
print("结果:", result)

默认连接到 127.0.0.1:60080

示例二:指定服务器地址和端口

from live_studio_open_service import call

result = call("say_hello", ["world"], host="10.71.157.126", port=60080)
print("结果:", result)

⚙️ 接口说明

call(
    name: str,
    args: list[str],
    host: str = "127.0.0.1",
    port: int = 60080,
    timeout: float = 5.0
) -> Any
参数 类型 说明
name str 远程调用的方法名
args list[str] 传入参数列表(字符串数组)
host str 目标服务器地址(可选)
port int 目标服务器端口(可选)
timeout float 超时时间(单位秒)

💡 返回值说明

函数返回远程调用返回的内容。如果网络错误或服务器未响应,将抛出 RuntimeError


📄 协议约定

  • 通信协议基于 TCP。
  • 消息采用 JSON 格式,末尾使用 \f 分隔。
  • 请求结构:
{
  "type": "call",
  "id": "timestamp_method",
  "data": {
    "type": "serviceMethod",
    "name": "method_name",
    "args": ["arg1", "arg2"]
  }
}

🛠 开发测试

# 构建包
python -m build

# 上传到测试 PyPI
twine upload --repository testpypi dist/*

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

live_studio_open_service-0.1.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

live_studio_open_service-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file live_studio_open_service-0.1.0.tar.gz.

File metadata

File hashes

Hashes for live_studio_open_service-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fc819d9c1b52e8f8545f799f1c0cb47465ecb57b9a7d6f2eb4079ea6a814a639
MD5 374770f012e43d4c35692c945c02e827
BLAKE2b-256 5842b59878f175aeef33fe5270a9a4a613689c40e4e62dabee10a2ef15858530

See more details on using hashes here.

File details

Details for the file live_studio_open_service-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for live_studio_open_service-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bba4175129a6e4255e0825cb7cafd6ac176017851b5076f0c54183bb90e1ae9b
MD5 843622a72822a8395db3471378de7a9c
BLAKE2b-256 3734df8f166e3ece6d546670b2233dff7466beafd591c56eee78199c2bd1b047

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