Skip to main content

autoscript-hub-sdk

AutoScript Hub 脚本开发 SDK —— 一行导入,获取浏览器、代理、输出目录等所有运行时变量。

安装

pip install autoscript-hub-sdk

快速开始

from autoscript_hub_sdk import env

# 浏览器配置
print(env.browser_port)    # 9222(调试端口)
print(env.browser_path)    # "C:\\Program Files\\Google\\Chrome\\..."

# 目录
print(env.output_dir)      # "D:\\output"
print(env.script_dir)      # 当前脚本所在目录

# 网络
print(env.proxy)           # "http://127.0.0.1:7890"

# 脚本参数(用户在表单中填写的值)
print(env.params)          # {"keyword": "手机", "page": 1}

# 自定义环境变量(环境管理 → 高级设置 → extra_env)
api_key = env.get("MY_API_KEY", "默认值")

两种导入方式

方式一:导入 env 对象(推荐)

from autoscript_hub_sdk import env

port = env.browser_port

方式二:直接导入变量

from autoscript_hub_sdk import browser_port, browser_path, output_dir, proxy

在 AutoScript Hub 中使用

在脚本的 config() 中声明依赖即可,Agent 会自动安装:

def config():
    return {
        "name": "我的脚本",
        "version": "1.0.0",
        "requirements": ["autoscript-hub-sdk", "DrissionPage>=4.0"],
        "params": [...],
    }

def main(keyword="", page=1):
    from autoscript_hub_sdk import env

    print(f"浏览器端口: {env.browser_port}")
    print(f"输出目录: {env.output_dir}")
    print(f"参数: keyword={keyword}, page={page}")

所有可用变量

属性 类型 环境变量 说明
env.browser_port int | None BROWSER_PORT 浏览器调试端口
env.browser_path str | None BROWSER_PATH 浏览器路径
env.output_dir str OUTPUT_DIR 输出目录
env.script_dir str — 脚本所在目录
env.proxy str | None http_proxy 代理地址
env.params dict — 脚本参数
env.get(key) any 自定义 任意环境变量

开发 & 发布

cd sdk
pip install build
python -m build
pip install twine
twine upload dist/*

Metadata

Release files for autoscript-hub-sdk 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autoscript-hub-sdk 1.0.0
File Size Uploaded Provenance Actions
autoscript_hub_sdk-1.0.0.tar.gz 4.0 kB Without provenance Details for autoscript_hub_sdk-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for autoscript-hub-sdk 1.0.0
File Interpreter ABI Platform Actions
autoscript_hub_sdk-1.0.0-py3-none-any.whl Python 3 none any Details for autoscript_hub_sdk-1.0.0-py3-none-any.whl

Total release size: 8.8 kB

Release files / autoscript_hub_sdk-1.0.0.tar.gz

Download URL autoscript_hub_sdk-1.0.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cff67a1bd8cdc28b4b61f6d72c3417e41849deee032c27bc321c9776d710a990
BLAKE2b-256 checksum
How to use checksums
639abf57f86ab5fad9f6ae66fe8e4184d18c47c6e2c0547982af1d9f5030b043
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / autoscript_hub_sdk-1.0.0-py3-none-any.whl

Download URL autoscript_hub_sdk-1.0.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
555f2a6e93fcd9a8c23af6761b52aa48c5ead3e8022c58998fab3c3730b51d59
BLAKE2b-256 checksum
How to use checksums
2042fea3da11cf6f3e571caa7a9e3d76d78539fdcb5c8b9b957a74505c3a4229
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Security for autoscript-hub-sdk 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page