mardi 24 novembre 2020

How do I make the proxy work? Python requests

import requests

http_proxy = "http://176.9.119.170:8080"

proxyDict = {
  "http": http_proxy,
}
url = 'http://2ip.ru'
s = requests.Session()
s.proxies = proxyDict
r = s.get(url)
print(r.text, r.url, r.headers)

This code give "requests.exceptions.TooManyRedirects: Exceeded 30 redirects." error.

Also, I previously tried to use a proxy in selenium, but there was a similar error. Moreover, even with working proxies(which was confirmed by checkers)




Aucun commentaire:

Enregistrer un commentaire