XxVoltage _
XxVoltage _

Reputation: 11

How to use specifically use HTTP (not HTTPS) proxy with python requests

I just want to know how to use HTTP proxies with python requests because valid HTTPS proxies are hard to find.

Code:

import requests

proxy = "85.208.210.33:8085"

proxies = {
    "https": "http://" + proxy,
    "http": "http://" + proxy
}

headers = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36"}
r = requests.get("https://httpbin.org/ip", headers=headers, proxies=proxies, timeout=3)
print(r.status_code)

Upvotes: 0

Views: 950

Answers (0)

Related Questions