IP address does not match with IP address of the proxy

Question:
The code i have written should print out the IP address I have written in the dictionary proxies but it isn’t.
Repl link:
https://replit.com/@jonathanessombe/new-attempt#main.py

import requests

proxies = {'https://httpbin.org': '198.211.101.99:3128'}

r = requests.get('https://httpbin.org/ip', proxies=proxies)
print(r.text)
1 Like

The issue with your code is in the way you’ve defined the proxies dictionary. It should be defined with the format http or https as the key and the proxy URL as the value:

import requests

proxies = {'https': 'http://198.211.101.99:3128'}

r = requests.get('https://httpbin.org/ip', proxies=proxies)
print(r.text)

@moderators is this allowed

Why are you pinging them? In this context, it’s not against the TOS. It’s only against the TOS if the proxy/proxies are meant to circumvent school bans.

I tried using your code but i keep getting the ProxyError on the terminal

1 Like

The proxy must be invalid then.