proxys.store
← 全部指南

curl、Python 与 Node

可直接使用的脚本示例。

Python,requests

import requests

proxy = "http://LOGIN:PASSWORD@gw.dataimpulse.com:823"
r = requests.get(
    "https://ipinfo.io/json",
    proxies={"http": proxy, "https": proxy},
    timeout=30,
)
print(r.json())

Node.js

使用 Node 内置的 undici 客户端,无需额外依赖。

import { ProxyAgent, fetch } from "undici";

const agent = new ProxyAgent("http://LOGIN:PASSWORD@gw.dataimpulse.com:823");
const res = await fetch("https://ipinfo.io/json", { dispatcher: agent });
console.log(await res.json());

注意事项

务必设置超时:住宅地址的响应比数据中心慢,没有超时的请求可能挂起数分钟。

重试请发起新请求,而不是复用同一连接:在 823 端口上,重试会来自另一个地址。

继续阅读