curl、Python 与 Node
可直接使用的脚本示例。
Python,requests
Python
import requests
proxy = "http://LOGIN:PASSWORD@HOST:823"
r = requests.get(
"https://ipinfo.io/json",
proxies={"http": proxy, "https": proxy},
timeout=30,
)
print(r.json())HOST 是您访问信息中的网关地址,LOGIN 和 PASSWORD 是账号和密码。三者都在订单页和“我的访问”中。
Node.js
使用 Node 内置的 undici 客户端,无需额外依赖。
Node.js
import { ProxyAgent, fetch } from "undici";
const agent = new ProxyAgent("http://LOGIN:PASSWORD@HOST:823");
const res = await fetch("https://ipinfo.io/json", { dispatcher: agent });
console.log(await res.json());注意事项
务必设置超时:住宅地址的响应比数据中心慢,没有超时的请求可能挂起数分钟。
重试请发起新请求,而不是复用同一连接:在 823 端口上,重试会来自另一个地址。