0

I'm writing a scraper that will extract information of a given proxy. I'm using python requests with private proxies having username and password to access "https://ip8.com/" that will give information about the proxy and will scrape the information.

Now, the problem is I tried almost everything but the request does not return anything, in fact does not return until timeout. Proxies are working perfectly fine, so no issues there.

I've tried almost every method. I've tried urllib3 as well, but had no success.

import requests
from requests.auth import HTTPProxyAuth

proxy_string = 'http://username:password@proxy:port'
s = requests.Session()
s.proxies = {"http": proxy_string , "https": proxy_string}
s.auth = HTTPProxyAuth("username","password")

r = s.get('https://ip8.com/') # OK
print(r.text)

I expect html of the page accessed through the IP to ip8.com

JeremyW
  • 5,157
  • 6
  • 29
  • 30
Salik95
  • 1
  • 3

1 Answers1

1
import requests

proxy_string = 'http://username:password@proxy:port'
proxyDict = {"http": proxy_string , "https": proxy_string}

r = requests.get('https://ip8.com/', proxies=proxyDict) # OK
print(r.text)

The above should work

Sam
  • 533
  • 3
  • 12