python_tor_proxy
1.0
ProxtorはPythonライブラリで、TORネットワークを介してHTTPリクエストを送信できます。 TORとの対話を簡素化し、IPの更新、GET/POSTリクエストの送信などを支援します。
ProxtorはPIPを使用してインストールできます。
pip install ProxtorProxtorは、TORをマシンにインストールして実行する必要があります。また、TORコントロールポートが9051に設定されており、パスワードが「Your_PassWord」に設定されていると想定しています(Proxtorを初期化するときにパスワードとポートを変更できます)。
パッケージはPython3.11で記述されていますが、Python 3.7+の任意のバージョンで動作するはずです。
Docker画像はこちらから入手できます。
もっとカスタムをやりたい場合は、dockerfileの例がリポジトリで利用できます。
Proxtorは非常に使いやすいです。これがそれを使用する方法の例です:
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 )ロギングはデフォルトで有効になり、ログレベルが情報に設定されています。 TOR IP更新の障害などの主要なイベントのログがあります。
貢献は大歓迎です。プルリクエストを送信するか、拡張機能、バグ、または機能リクエストの問題を作成してください。
このプロジェクトは、MITライセンスの下でライセンスされています。詳細については、ライセンスファイルを参照してください。