Skip to main content

Tor-Proxy

A simple way to send your requests with tor using tor-proxy.It doesn’t interfere with other tor processes on your computer, so you can use the Tor Browser or the system tor on their own.

PyPI version Downloads Downloads Python 3.6

Disclaimer:-

Use it only for educational purpose.

Features

  • No need root permission
  • Multiple instances

Compatability

Python 3.6+ is required.

Installation

pip install tor-proxy

Quickstart

  1. Import with from tor_proxy import tor_proxy .
  2. call function tor_proxy() , store as variable and give it as port argument in proxies.
# tor_proxy_example.py
from tor_proxy import tor_proxy
import requests

port = tor_proxy()

http_proxy  = f"socks5h://127.0.0.1:{port}"
https_proxy = f"socks5h://127.0.0.1:{port}"

proxies = { 
              "http"  : http_proxy, 
              "https" : https_proxy, 
            }

url = "https://api.ipify.org"

r = requests.get(url, proxies=proxies)

print(r.text)

Command Line Usage

After installing, you can run the Tor proxy service directly from the command line:

tor-proxy

This will start the Tor SOCKS proxy and print the port it is running on.

$ tor-proxy
connecting_to_tor: 100% - Done
Tor SOCKS proxy running on port: 47863

Additional Command Line Options

  • Run as a background (detached) process:

    tor-proxy --detach
    

    This will start the Tor proxy in the background.

  • Kill all running Tor processes started with /usr/bin/tor -f /tmp/...:

    tor-proxy --kill
    

    This will find and terminate all matching Tor processes.

Now you can use this port as proxy in code.

# tor_proxy_example.py
import requests

port = 47863

http_proxy  = f"socks5h://127.0.0.1:{port}"
https_proxy = f"socks5h://127.0.0.1:{port}"

proxies = { 
              "http"  : http_proxy, 
              "https" : https_proxy, 
            }

url = "https://api.ipify.org"

r = requests.get(url, proxies=proxies)

print(r.text)

Credit :- onionshare

Release files for tor-proxy 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tor-proxy 0.0.4
File Size Uploaded
tor_proxy-0.0.4.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tor-proxy 0.0.4
File Interpreter ABI Platform
tor_proxy-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 25.9 kB

Release files / tor_proxy-0.0.4.tar.gz

Download URL tor_proxy-0.0.4.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
edf3a1eb4a27e0389d22025c1d3d309834c24ecfe4ca196ec0efe3ce314f69ac
BLAKE2b-256 checksum
How to use checksums
9102d6ae85501ba0b87f6079055d1b47278ed809243f78b3a3243a2497d8fee0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / tor_proxy-0.0.4-py3-none-any.whl

Download URL tor_proxy-0.0.4-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a86fc95443b6bd75bec1c63e7187ce3a7e61235bdf42c171247bcf9a90a5da37
BLAKE2b-256 checksum
How to use checksums
709a97b66f916620c5c28eab2e534d04d6f5368866bda140d2457022c1175565
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page