I’m new to learning creating web proxies using Python. I do not really understand the concept of the Python program and how it is used to hide my IP address while accessing websites. Most Youtube tutorials and programming websites use a similar program as the example shown below, note that the ‘exampleproxyaddress’ must be taken from a free proxy website and not all proxies work.
from urllib import request as urlrequest PROXY_ADDRESS = 'exampleproxyaddress' url = 'http://icanhazip.com' request = urlrequest.Request(url) request.set_proxy(PROXY_ADDRESS, 'http') response = urlrequest.urlopen(request) print(response.read().decode('utf8'))
My understanding and expectations were different, I thought that after running the code, when I open the ‘http://icanhazip.com’ website using my web browser, my public IP would change to the proxy IP that I had entered in the code, but the IP shown was still my original public IP. Instead, I would only get a 200 response from the terminal returning my proxy IP address. The Youtube videos and websites did not explain or demonstrate well on how to use the code and its practicality.
I know the code is working fine and as intended but how can I use it for web browsing? For example, after running the program, I access the http://icanhazip.com website and it would show my proxy IP that I had entered earlier. Or am I completely misunderstanding the concept of web proxies?
Any advice would be greatly appreciated, thank you!