A Python utility for managing Tor processes to enable anonymous web browsing through SOCKS5 proxies.
Project description
tor-runner
A Python utility for managing Tor processes to enable anonymous web browsing through SOCKS5 proxies.
Installation
Requires local Tor Browser to be installed.
pip install py-tor-runner
requirements.txt is only necessary if you want to run the provided test files. Otherwise, tor-runner is a standalone library compatible with default Python packages.
Basic Usage with Requests
import requests
from tor import TorProxy
with TorProxy("C:/path/to/tor/browser/tor.exe") as proxy:
proxy_url = proxy.socks_addr # Returns "socks5://127.0.0.1:{port}"
# Example with requests
response = requests.get('https://check.torproject.org', proxies={
'http': proxy_url,
'https': proxy_url
})
print(response.text)
Basic Usage with Playwright
import time
from tor import TorProxy
from playwright.sync_api import sync_playwright
with TorProxy("C:/path/to/tor/browser/tor.exe") as proxy:
with sync_playwright() as p:
browser = p.firefox.launch(
headless=False,
proxy={"server": proxy.socks_addr}
)
# Each page has its own IP through the Tor network
page1 = browser.new_page()
page1.goto("https://check.torproject.org")
page2 = browser.new_page()
page2.goto("https://check.torproject.org")
time.sleep(5) # to let you check manually
browser.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_tor_runner-1.0.1.tar.gz.
File metadata
- Download URL: py_tor_runner-1.0.1.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c53f1fc8a494f780367d2733ec09464743d6b6446d1a0533b65b36884ea6051
|
|
| MD5 |
e29224813942ba2bf1b0f8fe3b671207
|
|
| BLAKE2b-256 |
512af67fd0248fee6d70ad663b10480927cb772db7b9504d3a64896b1146d349
|
File details
Details for the file py_tor_runner-1.0.1-py3-none-any.whl.
File metadata
- Download URL: py_tor_runner-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96af865a846e62bedad64e9c95746d95129016d64a5b543b9bbecea7927123ab
|
|
| MD5 |
0a270c384747dc060a6b75a72796daa3
|
|
| BLAKE2b-256 |
147548cd4e80942a51705ab1fead936a18ca0e65ab806c7d75dc945a84c6803b
|