选择国家
了解如何定位特定代理位置,以及如何使用轮换逻辑。
如果你想访问来自特定地点的 IP,你必须提供一个 国家 – 参数,并在用户名中使用两位字母的国家代码。以下是 国家 参数。例如,如果你想使用美国国家参数,请添加 country-US.
在下表中查看支持国家的完整列表。
例如,如果你只想轮换美国代理池,请使用轮换端口 8000 并配合一个参数 country-US 在用户名中:
curl -x dc.oxylabs.io:8000 -U 'user-USERNAME-country-US:PASSWORD' https://ip.oxylabs.io/location代码示例
curl -x dc.oxylabs.io:8000 -U 'user-USERNAME-country-COUNTRY:PASSWORD' https://ip.oxylabs.io/location#pip install requests
import requests
username = 'USERNAME'
密码 = 'PASSWORD'
country = 'COUNTRY'
proxy = 'dc.oxylabs.io:8000'
代理 = {
"https": ('https://user-%s-country-%s:%s@%s' % (username, country, password, proxy))
}
response=requests.get("https://ip.oxylabs.io/location", proxies=proxies)
print(response.content)//npm install axios
const axios = require("axios");
const https = require("https");
const client = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false,
}),
});
const username = 'USERNAME';
const country = 'COUNTRY'
const password = 'PASSWORD'
client
.get("https://ip.oxylabs.io/location", {
proxy: {
protocol: "https",
host: "dc.oxylabs.io",
port: 8000,
auth: {
username: `user-${username}-country-${country}`,
password: password,
},
},
})
.then((res) => {
console.log(res.data);
})
.catch((err) => console.error(err));
订阅方式之间的差异
Datacenter per IP 提供轮换端口和 国家 参数的用户将收到一个 来自其 Proxy 列表中所选国家的随机 IP ,每次新请求都会更换。
Datacenter per traffic 提供轮换端口和 国家 参数将收到 来自整个代理池中所选国家的随机 IP。
最后更新于
这有帮助吗?

