I have installed Tor on a command-line only environment without the browser, Tor Socks Proxy is running on 9050.
To check if the proxy code is running correctly i used:
% curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -s https://check.torproject.org/ | cat | grep -m 1 Congratulations | xargs
Congratulations. This browser is configured to use Tor.
But i need to do this test programmatically with python.
How can i programmatically test if the tor socks5 proxy is running and that it configured correctly using a python script?