1

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!

1 Answer 1

1

Your code work on my side : the returned IP address by the python program is different when I set a proxy server.

Define proxy parametesr in a program will not set proxy parameters for all programs of your system.

Each application don't get proxy parameters from the same location.

In your case, you have only set a proxy for your python program, but not for your web browser.

If you want to use a proxy for your web browser, you need to configure the proxy in the parameters of the web browser.

So if you want to do that with a python program you firstly need to know how your web browser store it's proxy parameters, then edit these parameters.

1
  • Yes the code works as intended, but not to what I was expecting. Thank you for your advice, I will now try to understand the web browser's proxy parameters to write a web proxy program that allows for web browsing under the given proxy IP, which was my original goal.
    – Boof
    Jan 21, 2021 at 8:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .