SOCKS proxies with Python

Im using the following code to proxy my traffic in my Django app through socks proxy,

def bind_proxy_port(enable=True):
    try:
        if enable == True:
            socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 8080)
            socket.socket = socks.socksocket
        return True
    except:
        raise Exception("unable to set proxy 127.0.0.1:8080")

The traffic sent through it is HTTPS traffic. However, this leads to the fact that traffic on Rabbit-MQ is also proxied, which interrupts the application. Is there a way to determine only one destination port to proxy through and / or any other solution?

+4
source share
1 answer

Source: https://habr.com/ru/post/1629944/


All Articles