Metadata-Version: 2.4
Name: http-jump-once
Version: 0.1.0
Summary: HTTP / WebSocket request forwarding SDK
Home-page: https://github.com/lhj/http-jump-once
Author: lhj
Author-email: lhj@jumptox.top
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28.0
Requires-Dist: websocket-client>=1.4.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# HTTP Jump Once SDK

HTTP / WebSocket 请求转发平台 Python SDK。

## 安装

```bash
pip install http-jump-once
```

## 快速开始

```python
from jump import Client

client = Client(api_key="jk_live_xxxxxxxxxxxx")

# HTTP 转发
result = client.http.forward(
    url="https://httpbin.org/post",
    method="POST",
    body='{"hello": "world"}',
    headers={"Content-Type": "application/json"}
)
print(result.status_code, result.body)

# WebSocket 转发
ws = client.websocket.connect("wss://stream.example.com/ws")
ws.send("hello")
print(ws.recv())
ws.close()
```

## API

### Client(api_key, base_url)

- `api_key` — 平台 API Key（以 `jk_live_` 开头）
- `base_url` — 平台地址，默认 `http://api.jumptox.top`

### HTTP 转发

```python
result = client.http.forward(
    url="https://example.com/api",
    method="GET",          # GET/POST/PUT/DELETE/PATCH
    headers={},            # 自定义请求头
    params={},             # URL 参数
    body="",               # 请求体
    timeout=30,            # 超时秒数
    follow_redirects=True, # 跟随重定向
    verify_ssl=True        # SSL 验证
)
```

返回 `HttpResult`：
- `status_code` — 状态码
- `headers` — 响应头
- `body` — 响应体（自动 JSON 解析）
- `elapsed` — 耗时(ms)

### WebSocket 转发

```python
ws = client.websocket.connect("wss://example.com/ws")
ws.send("message")
data = ws.recv()
ws.close()
```
