While debugging a Python script that sends HTTP requests through a proxy, I ran into a strange issue.
The proxy works perfectly when tested with curl:
curl -x http://user:pass@proxy:port https://quantumproxies.io
This returns the correct IP, so the proxy itself is clearly working.
However the equivalent Python code fails:
python
import requests
proxy = "http://user:pass@proxy:port"
proxies = {
"http": proxy,
"https": proxy
}
url = "https://httpbin.org/ip"
response = requests.get(
url,
proxies=proxies
timeout=10
)
print(response.json())
Top comments (0)