Metadata-Version: 2.4
Name: autoscript-hub-sdk
Version: 1.0.0
Summary: AutoScript Hub 脚本开发 SDK —— 一行导入，获取浏览器、代理、输出目录等所有运行时变量
License-Expression: MIT
Project-URL: Homepage, https://github.com/your-org/AutoScript_Hub
Keywords: autoscript,automation,browser,sdk
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# autoscript-hub-sdk

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

## 安装

```bash
pip install autoscript-hub-sdk
```

## 快速开始

```python
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 对象（推荐）**

```python
from autoscript_hub_sdk import env

port = env.browser_port
```

**方式二：直接导入变量**

```python
from autoscript_hub_sdk import browser_port, browser_path, output_dir, proxy
```

## 在 AutoScript Hub 中使用

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

```python
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` | 自定义 | 任意环境变量 |

## 开发 & 发布

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