Residential Sticky Sessions
The ScrapeOps Residential Proxy Aggregator enables you to use the same IP address for multiple requests using the sticky_session
query parameter.
For example, adding sticky_session=7
to a group of requests will tell the API to use the same proxy IP for all of these requests. The session number you set can be any number from 0 to 10000.
This is useful if you are scraping a website where you need to chain together multiple requests from the same IP address to get the data you need, such as:
- Maintaining login sessions
- Following pagination links
- Multi-step form submissions
- Shopping cart operations
If no sticky_session
parameter has been set then the proxy will use a new IP address every time.
Example Usage
cURL
curl -k -x "http://scrapeops.sticky_session=7:YOUR_API_KEY@residential-proxy.scrapeops.io:8181" "https://httpbin.org/ip"
Python
import requests
proxy = {
'http': 'http://scrapeops.sticky_session=7:YOUR_API_KEY@residential-proxy.scrapeops.io:8181',
'https': 'http://scrapeops.sticky_session=7:YOUR_API_KEY@residential-proxy.scrapeops.io:8181'
}
# These requests will use the same IP address
response1 = requests.get('https://httpbin.org/ip', proxies=proxy)
response2 = requests.get('https://httpbin.org/ip', proxies=proxy)
Session Duration
Sticky sessions remain active for 10 minutes from the last request. After this period, a new IP address will be assigned even if using the same session ID.
Important Notes
Session Duration
- Sessions remain active for 10 minutes from the last request
- After 10 minutes of inactivity, a new IP will be assigned
- There is no limit to how long you can keep a session active with regular requests
Best Practices
- Use different session IDs for different scraping tasks
- Keep session IDs consistent within the same scraping flow
- Consider implementing retry logic for expired sessions
For high-volume scraping, consider rotating through multiple session IDs to prevent overloading any single IP address.