I want to write a simple script that takes a list of proxies and checks whether or not I am able to connect through them.
After some research, the requests
module seems to have everything I need.
I'm running into one snag, request.get()
doesn't raise an error when it isn't able to connect to a proxy?
I'm trying
import requests
proxy = {"http":"http://127.0.0.1:xxxx"}
# I don't have any proxies running any in the loopback space
requests.get("https://www.google.com", proxies=proxy)
I would expect some sort of error that I could try/except, but instead I get <Response [200]>
So it looks like it's able to make the request? Does requests
ignore the proxy if it's unable to connect?
I've tried reading the requests documentation regarding making requests and proxies. I've also looked for similar stack exchange questions but haven't been able to find an answer.
Figured it out. I was listing the proxy as an http
proxy and then trying to make an https
connection.
After changing the key to "https"-
proxy = {"https":"http://127.0.0.1:xxxx"}
-I got the error I was expecting.