Session
To utilize a single proxy for multiple requests, simply include the X-SU-Session-Id header with a randomly generated string as the session ID. This ID will be associated with a unique proxy, which will be used for all subsequent requests within a 10-minute timeframe. Once the 10 minutes have elapsed, a new IP will be assigned to that specific session ID.
curl -k -v -x unblock.smartproxy.com:60000 \
-U "USERNAME:PASSWORD" "https://ip.smartproxy.com/" \
-H "X-SU-Session-Id: random123"
import requests
proxies = {
'http': 'http://USERNAME:[email protected]:60000',
'https': 'http://USERNAME:[email protected]:60000'
}
headers= {
'X-SU-Session-Id': 'random123'
}
response = requests.request(
'GET',
'https://ip.smartproxy.com/',
verify=False,
proxies=proxies,
headers=headers
)
print(response.text)
import fetch from 'node-fetch';
import createHttpsProxyAgent from 'https-proxy-agent'
const username = 'YOUR_USERNAME';
const password = 'YOUR_PASSWORD';
const agent = createHttpsProxyAgent(
`http://${username}:${password}@unblock.smartproxy.com:60000`
);
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;
const headers = {
'X-SU-Session-Id': 'random123'
}
const response = await fetch('https://ip.smartproxy.com/', {
method: 'get',
headers: headers,
agent: agent
});
console.log(await response.text());
Updated about 1 year ago