I've been trying to make a program to check for IP addresses using python but the requests module doesn't use proxies I gave to it, Here is part of the code:
proxies = {"http" : "socks4://51.254.162.207:5678"}
ip = requests.get('https://api.ipify.org',proxies=proxies).content.decode('utf8')
print(ip)
input("press any key to finish ...")
I always get my own Public IP it is also noteworthy that I am using a VPN
Thanks in advance !
You have to set a https
entry in your dict:
# HERE ---v
proxies = {"https" : "socks4://51.254.162.207:5678"}
ip = requests.get('https://api.ipify.org',proxies=proxies).content.decode('utf8')
Don't forget to install requests
with socks
support:
# pip install requests[socks]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.