选择国家
了解如何定位特定代理位置以及如何使用轮换逻辑。
如果您想访问来自特定位置的 IP,您必须在用户名中提供一个 country – 参数,该参数在用户名中使用两个字母的国家代码。下面是 country 参数的示例。例如,如果您想使用美国的国家参数,请添加 country-US.
在下表中查找受支持国家的完整列表。
例如,如果您只想轮换美国代理池,请在用户名中将 rotating port 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 = 'PASSWORD'
country = 'COUNTRY'
proxy = 'dc.oxylabs.io:8000'
proxies = {
"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));
订阅方式之间的差异
按单个 IP 的数据中心 提供 rotating port 和 country 参数的用户将会从其代理列表中收到来自所选国家的 随机 IP 每次新请求时。
按流量的数据中心 提供 rotating port 和 country 参数的用户将会从整个代理池中收到来自所选国家的 随机 IP。
最后更新于
这有帮助吗?

