Are there any libraries that make it easier to do networking in Python using Tor? I'd like to be able to write IRC bots/clients and possibly use other networks, so none of the HTTP libraries which have you set a proxy server would work, as I need access to more than just HTTP. The best solution for me would be a library which allows me to do pretty much direct socket programming in Python, only it redirects things through the Tor network. Does something like this exist? The next best thing would be a library for SOCKS5 communication, but I couldn't find anything like that either.

I should also note that I've come across socksipy, but that project seems to have been abandoned, so I'm not sure if I should be using it. Does anyone know the status of the project or if it's okay to use?

2 Answers 2


If you want to use event-based code (namely Twisted), there's https://github.com/habnabit/txsocksx for client-side stuff (i.e. socks proxy) and http://txtorcon.readthedocs.org/en/latest/ for speaking Tor's control protocol to Tor (and other things, like launching new Tor instances for hidden services, etc).


For client usage controller libraries like Stem and Txtorcon aren't necessary. Tor is a local socks proxy and any socket library (SocksiPy, PycURL, etc) will do the trick. See the tutorial for this...

Tutorial: To Russia With Love

The trick is making sure your application doesn't leak. DNS queries and other edge cases might still expose your real IP so checking your application with something like Wireshark might be wise.

You must log in to answer this question.

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