Skip to main content

A simple python proxy for Tor

Project description

Proxtor

Proxtor is a Python library that allows you to send HTTP requests over the TOR network. It simplifies interacting with TOR and helps with IP renewal, sending GET/POST requests, and more.

Installation

Proxtor can be installed using pip:

pip install Proxtor

Requirements

Proxtor requires Tor to be installed on your machine and running. It also assumes that the Tor control port is set to 9051 and that the password is set to 'your_password' (the password and port can be changed when initializing Proxtor).

The package as been written in python3.11 but should work with any version of python 3.7+.

A Docker image is available here.

If you want to do something more custom, an example Dockerfile is available in the repository.

Usage

Initialization

Proxtor is very easy to use. Here is an example of how to use it:

from Proxtor import Tor
tor = Tor(tor_password='your_password', tor_port=9051)

# Get request
response = tor.get_request(url='https://example.com', headers={'User-Agent': 'Mozilla/5.0'})
print(response.content)

# Post request
response = tor.post_request(url='https://example.com', headers={'User-Agent': 'Mozilla/5.0'}, data={'key': 'value'})
print(response.content)

# Get the current IP
# Tor ip
print(tor.get_ip())
# Local machine ip
print(tor.get_ip(show_tor_ip=False))

# Get a new IP (won't work 100% of the time as it depends on the exit node)
tor.get_new_ip(max_retries=5)

Logging

Logging is enabled by default, with the log level set to INFO. You will find logs for key events such as TOR IP renewal failures.

Contributing

Contributions are very welcome. Please submit a pull request or create an issue for any enhancements, bugs or feature requests.

License

This project is licensed under the MIT license. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

proxtor-1.0.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

proxtor-1.0.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file proxtor-1.0.0.tar.gz.

File metadata

  • Download URL: proxtor-1.0.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for proxtor-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e1099541b6e2507d8672c0557b3f386c86081f7c63bdfa2e6f8ff2e295ff1596
MD5 ba6b6c891e037cbe7565b617907148c2
BLAKE2b-256 7a0b177294f3dfc2c288b057a006cc8645b0d229f7db9aac7c20786db4c987f0

See more details on using hashes here.

File details

Details for the file proxtor-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: proxtor-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for proxtor-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c48c50bf06ad5ee72160e2e30986783890d28f1f392984d69920a51ef05d1876
MD5 fa44905c5cafe60ef897537b42c2a65a
BLAKE2b-256 2f2ba6c082bb362e44c826ef083ac8a7100d5cdc34682bfe2836a7ed5f9f60f5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page