Geotargeting and session control
Adding targeting parameters
Connecting to Nimble IP with user:password authentication allows you to control session targeting and behavior by modifying the user portion of the request.
Selecting your target geolocation
To request an IP from a specific country, add country-<country_code> to the user portion:
curl -x http://account-accountName-pipeline-pipelineName-country-countryCode:[email protected]:7000 https://targetpage.comimport requests
proxies = {
'http': 'http://account-accountName-pipeline-pipelineName-country-countryCode:[email protected]:7000',
'https': 'https://account-accountName-pipeline-pipelineName-country-countryCode:[email protected]:7000'
}
url = 'https://ipinfo.io'
response = requests.get(url, proxies=proxies)
print(response.status_code)
print(response.text)const axios = require('axios');
const targetAddress = "http://ipinfo.io/json";
const getProxy = async () => {
return {
proxy: {
host: "account-accountName-pipeline-pipelineName-country-countryCode:[email protected]",
port: 7000
}
}
}
const run = async () => {
const res = await axios(targetAddress, getProxy());
return res.data;
}
(async () => {
var response = await run()
console.log(response);
console.log("DONE!")
})();We use ISO 3166 alpha-2 Country Codes (use ALL to randomly select a country).
If you’d like to get even more specific, you can also add state-<state_code> or city-<city_code> to target a US state or a City. For more details see Country/state/city geotargeting
Using sticky IPs
A sticky IP allows you to make multiple requests through the same IP address. This is done by initiating a session, which associates your request with the sticky IP address.
To create a session, add session-<random_string> to the user portion.
For example:
curl -x http://account-accountName-pipeline-pipelineName-session-randomString:[email protected]:7000 https://targetpage.comimport requests
proxies = {
'http': 'http://account-accountName-pipeline-pipelineName-session-randomString:[email protected]:7000',
'https': 'https://account-accountName-pipeline-pipelineName-session-randomString:[email protected]:7000'
}
url = 'https://ipinfo.io'
response = requests.get(url, proxies=proxies)
print(response.status_code)
print(response.text)const axios = require('axios');
const targetAddress = "http://ipinfo.io/json";
const getProxy = async () => {
return {
proxy: {
host: "account-accountName-pipeline-pipelineName-session-randomString:[email protected]",
port: 7000
}
}
}
const run = async () => {
const res = await axios(targetAddress, getProxy());
return res.data;
}
(async () => {
var response = await run()
console.log(response);
console.log("DONE!")
})();Geo-sessions: Precise location-based sessions
Nimble Geo-sessions are a next-gen session solution that provides a variety of upgrades, including:
Geo-sessions are incredibly easy to use; simply pass the parameter geosession along with a random string of your choosing that will serve as the Geo-session ID.
For example:
Be sure to use the same parameters across requests that share the same Geo-session. If the location targeting is changed, but the Geo-session ID remains the same, a new session will still be initiated.
Learn more about how Geo-sessions work and how to use them.
Combining parameters
All of the parameters we’ve covered before can be used together in a single request. This is done by chaining them together, like in this example:
Last updated
