Skip to content

Instantly share code, notes, and snippets.

@ifnull
Last active November 22, 2022 21:46
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ifnull/9026823 to your computer and use it in GitHub Desktop.
Save ifnull/9026823 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
@pilgrim2go
Copy link

Thanks.
to correct
change forward-socks5 / 127.0.0.1:9150 . to forward-socks5 / 127.0.0.1:9050 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment