0% found this document useful (0 votes)
22 views4 pages

WebUkdkddknblocker MD

Eksjsjj

Uploaded by

rere12be
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views4 pages

WebUkdkddknblocker MD

Eksjsjj

Uploaded by

rere12be
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

https://developers.oxylabs.

io/advanced-proxy-solutions/web-unblocker
https://developers.oxylabs.io/advanced-proxy-solutions/web-unblocker/getting-
started

example python :
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',
}

response = requests.request(
'GET',
'https://ip.oxylabs.io/location',
verify=False, # Ignore the SSL certificate
proxies=proxies,
)

# 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)

https://developers.oxylabs.io/advanced-proxy-solutions/web-unblocker/making-
requests :

https://developers.oxylabs.io/advanced-proxy-solutions/web-unblocker/making-
requests/session
example code session :
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)

https://developers.oxylabs.io/advanced-proxy-solutions/web-unblocker/making-
requests/geo-location
https://developers.oxylabs.io/advanced-proxy-solutions/web-unblocker/making-
requests/headers :
example code custom headers :
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-force-headers': '1',
'Accept-Language': 'en-GB',
'Your-Header-Name': 'interesting header content'
}

response = requests.get(
'https://ip.oxylabs.io/headers',
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)

example code custom cookies :


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 = {
'Cookie': 'NID=1234567890',
'x-oxylabs-force-cookies': '1'
}
response = requests.get(
'https://example.com',
proxies=proxies,
headers=headers,
verify=False # Ignore certificate verification
)

# 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)

https://developers.oxylabs.io/advanced-proxy-solutions/web-unblocker/making-
requests/custom-status-code
example code custom status code :
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-Successful-Status-Codes': '500,501,502,503'
}

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)
https://developers.oxylabs.io/advanced-proxy-solutions/web-unblocker/making-
requests/post-requests
example code post requests :
# Web Unblocker doesn't only support sending GET requests, but also lets you POST
to a web endpoint of your choice. This means that you can send data to a target
website, which can then make the website return a different result.
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',
}

data = {
'Your POST JSON': 'data'
}

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

# 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)

https://developers.oxylabs.io/advanced-proxy-solutions/web-unblocker/headless-
browser :
https://developers.oxylabs.io/advanced-proxy-solutions/web-unblocker/headless-
browser/javascript-rendering
https://developers.oxylabs.io/advanced-proxy-solutions/web-unblocker/headless-
browser/browser-instructions-beta

You might also like