For the complete documentation index, see llms.txt. This page is also available as Markdown.

Session

Use the same proxy for multiple Web Unblocker requests with session IDs. Maintain proxy continuity for up to 10 minutes per session.

If you want to use the same proxy to make multiple requests, you can add the X-Oxylabs-Session-Id header with a randomly-generated string to the session ID. We will assign an individual proxy to this ID and use it for all following requests for up to 10 minutes. After that, we will assign a new proxy to that particular session ID.

For optimal website access, Web Unblocker employs pre-defined sessions. Please refrain from sending any custom parameters commonly used for better access, as they may interfere with Web Unblocker’s ability to get quality data.

Code examples

curl -k -v -x https://unblock.oxylabs.io:60000 \
-U 'USERNAME:PASSWORD' \
'https://ip.oxylabs.io/location' \
-H 'X-Oxylabs-Session-Id: 123randomString'
import requests

# Use your Web Unblocker credentials here.
USERNAME, PASSWORD = 'YOUR_USERNAME', 'YOUR_PASSWORD'

# Define proxy dict.
proxies = {
  'http': f'http://{USERNAME}:{PASSWORD}@unblock.oxylabs.io:60000',
  'https': f'https://{USERNAME}:{PASSWORD}@unblock.oxylabs.io:60000',
}

headers = {
    'X-Oxylabs-Session-Id': '123randomString'
}

response = requests.get(
    'https://ip.oxylabs.io/location',
    verify=False,  # It is required to ignore certificate
    proxies=proxies,
    headers=headers,
)

# Print result page to stdout
print(response.text)

# Save returned HTML to result.html file
with open('result.html', 'w') as f:
    f.write(response.text)

Last updated

Was this helpful?