DEV Community

Hunter Drum
Hunter Drum

Posted on

Python set linux proxy

So I am working on a Python project for a Raspberry Pi, that will download a list of proxies daily from a site.

However, whenever I lookup/google how to set the system proxy, I am unable to achieve anything. When I load up firefox, my IP is always the same.

The proxies in the list are http, https, socks4, and socks5.

Anyone know of a way to set the system proxy dynamically based on the type of proxy via Python on Linux (Debian)?

What I have so far:

os.environ[str(proxyData["protocol"]) + "_proxy"] = str(proxyData["ip"]) + ":" + str(proxyData["port"])
Enter fullscreen mode Exit fullscreen mode

EDIT:
What I'm shooting for:
client -> (openvpn) -> Pi -> (Python/Proxy) -> internet

Top comments (2)

Collapse
 
theredspy15 profile image
Hunter Drum • Edited

First, thank you for replying!

I have already attempted: export http_proxy="proxy-ip:proxy-port"

I also would like to add, I'm only trying to get openvpn to use the proxy

What I'm shooting for:
client -> (openvpn) -> Pi -> (Python/Proxy) -> internet

 
theredspy15 profile image
Hunter Drum

That's genius! I will try that right away!

I kinda feel a little silly, as that is rather simple