Skip to content

Instantly share code, notes, and snippets.

@stratoukos
Created January 19, 2015 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stratoukos/7545c5c909fa9b5d1cfb to your computer and use it in GitHub Desktop.
Save stratoukos/7545c5c909fa9b5d1cfb to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
"""
You need a way to verify whether the proxy is used. An easy one is to install
squid and block all other outgoing connections with something like:
iptables -A OUTPUT -m owner --uid-owner root -j ACCEPT
iptables -A OUTPUT -m owner --uid-owner proxy -j ACCEPT
iptables -A OUTPUT -p tcp --dport 80 -j DROP
iptables -A OUTPUT -p tcp --dport 443 -j DROP
"""
import urllib3
proxy = urllib3.ProxyManager('http://localhost:3128/')
count = 0
while True:
r = proxy.request('GET', 'https://pypi.python.org/')
print count
count += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment