Skip to content

Instantly share code, notes, and snippets.

@pilgrim2go
Forked from ifnull/README.md
Created November 22, 2017 09:27
Show Gist options
  • Save pilgrim2go/92419939d2fc5f504e91996190ae88bc to your computer and use it in GitHub Desktop.
Save pilgrim2go/92419939d2fc5f504e91996190ae88bc to your computer and use it in GitHub Desktop.
Using TOR as a proxy for Python on OSX
#!/usr/bin/python
import requests
proxies = {
"http": "http://127.0.0.1:8118"
}
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.73.11 (KHTML, like Gecko) Version/7.0.1 Safari/537.73.11'
}
r = requests.get("http://www.telize.com/ip", proxies=proxies, headers=headers)
print r.text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment