HTTP / WebSocket request forwarding SDK
Project description
HTTP Jump Once SDK
HTTP / WebSocket 请求转发平台 Python SDK。
安装
pip install http-jump-once
快速开始
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 转发
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 转发
ws = client.websocket.connect("wss://example.com/ws")
ws.send("message")
data = ws.recv()
ws.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
http_jump_once-0.1.0.tar.gz
(5.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file http_jump_once-0.1.0.tar.gz.
File metadata
- Download URL: http_jump_once-0.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8eff2c6b17765e2e55f8c4732c7c96bfc01d1ae2bf77d4986c5dbd7602492b06
|
|
| MD5 |
fc88fca991d9656f6cdac57068a48a58
|
|
| BLAKE2b-256 |
00e8922c25006d7b5f13c81c2bf2c6819d3fa972455cfcc565a45ac1afea9254
|
File details
Details for the file http_jump_once-0.1.0-py3-none-any.whl.
File metadata
- Download URL: http_jump_once-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5276aca4ffbdab9a14fcf5c13045a92ddd0c1c8a1ba0237b94ceeae169c0c6cf
|
|
| MD5 |
ed1513fbdc63cb8878f39770ab769d35
|
|
| BLAKE2b-256 |
06a50913caad32d3c60bbc237d7abfdf63e93bdf8e5280c0a0b99835e17b4e0d
|