Open jafeha opened 11 years ago
i suggest using a --proxy localhost:port commandline switch.
http://docs.python-requests.org/en/latest/user/advanced/#proxies
this would be very easy, at least theoretically. i made a simple test with urllib3 (python requests). the problem is, that tor uses a socks proxy, while ullib3 only works with http/https/ftp proxies.
simple code adaptation would look like this and works for http those proxies:
[DEFAULT]
proxy = None
clparser.add_argument("-p", "--proxy", help="Proxy Server: [IP:Port]")
update_config("DEFAULT", "proxy", args.proxy)
if parser.get("DEFAULT", "proxy") == None:
proxies = None
else
proxies = {'http':'parser.get("DEFAULT", "proxy")','https':'parser.get("DEFAULT", "proxy")'}
down = requests.get(url, proxies)
for further testing, here my python log:
import requests
def proxycheck(proxyvalue):
if proxyvalue == None:
proxies=None
r = requests.get('http://check.torproject.org/', proxies=proxies)
print r
print r.content
else:
proxies={'http':proxyvalue, 'https':proxyvalue}
r = requests.get('http://check.torproject.org/', proxies=proxies)
print r
print r.content
i would actually suggest that we only support http proxies until urllib3 supports socks5. this is not that difficult. the code here works with privoxy running on port 8118 and forwarding to a locally installed tor node on port 9050. for further information read "I need an HTTP proxy. Where did Polipo go?" and the referenced privoxy example configuration: "How do I use Privoxy together with Tor?".
i'll implement the code as suggested above and see how it works.
running into the next problem, http proxy works, but https server still fails: http://stackoverflow.com/a/13710154 we might dig a little deeper and try this: http://stackoverflow.com/questions/14390605/python-requests-ssl-issue
i upgraded urllib3 to v1.6 and requests to v1.2.3 using "pip install --upgrade" but i'm still having this issue. don't know much further.
A friend suggested an opt in switch for using Tor while creating the stick. Good thought, thats a paraparabird. I might implement this possibility later. This issue is meant to remind me of that idea.