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()
Metadata
Release files for py-tor-runner 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_tor_runner-1.0.1.tar.gz | 4.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_tor_runner-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.1 kB
Release files / py_tor_runner-1.0.1.tar.gz
| Download URL | py_tor_runner-1.0.1.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c53f1fc8a494f780367d2733ec09464743d6b6446d1a0533b65b36884ea6051
|
|
BLAKE2b-256 checksum How to use checksums |
512af67fd0248fee6d70ad663b10480927cb772db7b9504d3a64896b1146d349
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / py_tor_runner-1.0.1-py3-none-any.whl
| Download URL | py_tor_runner-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96af865a846e62bedad64e9c95746d95129016d64a5b543b9bbecea7927123ab
|
|
BLAKE2b-256 checksum How to use checksums |
147548cd4e80942a51705ab1fead936a18ca0e65ab806c7d75dc945a84c6803b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|