Proxy Rotation
Learn how to use the proxy rotation feature of ISP Proxies to switch IPs automatically. This will improve your scraping success.
ISP Proxies support proxy rotation. To use this feature you need to change your port number to 8000. With each new request you will receive a random IP from your proxy list.
Code examples
curl -x isp.oxylabs.io:8000 -U "user-USERNAME:PASSWORD" https://ip.oxylabs.io/location #pip install requests
import requests
username = 'USERNAME'
password = 'PASSWORD'
proxy = 'isp.oxylabs.io:8000'
proxies = {
"https": ('https://user-%s:%s@%s' % (username, 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 password = 'PASSWORD'
client
.get("https://ip.oxylabs.io/location", {
proxy: {
protocol: "https",
host: "isp.oxylabs.io",
port: 8000,
auth: {
username: `user-${username}`,
password: password,
},
},
})
.then((res) => {
console.log(res.data);
})
.catch((err) => console.error(err));
IPs will be selected from the indicated country pool if you provide a country- parameter. For example, if you want to rotate your United States proxy pool only, use a parameter country- and add two letter country code country-US in your user string.
Code examples
curl -x https://isp.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 = 'isp.oxylabs.io:8001'
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: "isp.oxylabs.io",
port: 8000,
auth: {
username: `user-${username}-country-${country}`,
password: password,
},
},
})
.then((res) => {
console.log(res.data);
})
.catch((err) => console.error(err));
Last updated
Was this helpful?

