指南
各工具的代理连接方法
在 Python requests 中使用代理
requests 是 Python 中最常用的网页请求库之一。在 proxies 中填入 ProxySup 网关地址即可直接连接。
查看指南为 Playwright 连接代理
Playwright 是用代码操作浏览器的工具。启动浏览器时在 proxy 选项中填入网关、用户名和令牌,所有页面请求都会经过 ProxySup。
查看指南为 Scrapy 连接代理
Scrapy 是用于构建采集大量页面的爬虫的 Python 工具。在请求的 meta 中填入 proxy,每个请求都会经过 ProxySup。
查看指南
通用
所有工具使用相同的连接信息
只要有网关、用户名和令牌这三项,就能在任何工具中连接。
| 网关 | gate.proxysup.com:7777 |
|---|---|
country-国家代码 | 指定连接的国家 |
city-城市名 | 进一步指定城市。仅用于支持城市定位的国家 |
session-名称 | 开启固定会话。名称相同则使用同一 IP |
type-mobile 或 type-dc | 切换为移动或数据中心代理。不写则为住宅代理 |
| 密码 | 账户的访问令牌 |
curl -x gate.proxysup.com:7777 \
-U "user-country-us:YOUR_TOKEN" \
https://ipinfo.io/jsonimport requests
proxy = "http://user-country-us:[email protected]:7777"
res = requests.get("https://ipinfo.io/json",
proxies={"http": proxy, "https": proxy})
print(res.json())import { ProxyAgent, fetch } from "undici";
const agent = new ProxyAgent("http://user-country-us:[email protected]:7777");
const res = await fetch("https://ipinfo.io/json", { dispatcher: agent });
console.log(await res.json());$ch = curl_init("https://ipinfo.io/json");
curl_setopt($ch, CURLOPT_PROXY, "gate.proxysup.com:7777");
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "user-country-us:YOUR_TOKEN");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);