erdiaker / Torrequest
Simple Python interface for HTTP(s) requests over Tor
Stars: ✭ 175
Programming Languages
python
139335 projects - #7 most used programming language
Projects that are alternatives of or similar to Torrequest
Grequests
A Go "clone" of the great and famous Requests library
Stars: ✭ 1,843 (+953.14%)
Mutual labels: requests
Requests Unixsocket
Use requests to talk HTTP via a UNIX domain socket
Stars: ✭ 153 (-12.57%)
Mutual labels: requests
Learn2018 Autodown
清华大学新版网络学堂课程自动下载脚本 / A python script to clone all files from learn.tsinghua.edu.cn
Stars: ✭ 160 (-8.57%)
Mutual labels: requests
Webcc
Lightweight C++ HTTP client and server library based on Asio for embedding purpose.
Stars: ✭ 167 (-4.57%)
Mutual labels: requests
Docker Tor Hiddenservice Nginx
Easily setup a hidden service inside the Tor network
Stars: ✭ 145 (-17.14%)
Mutual labels: tor
Instahack
Best Tool For instagram bruteforce hacking Tool By EvilDevil
Stars: ✭ 139 (-20.57%)
Mutual labels: tor
Redux Arc
A declarative way to make request with redux actions
Stars: ✭ 162 (-7.43%)
Mutual labels: requests
Python Simple Rest Client
Simple REST client for python 3.6+
Stars: ✭ 143 (-18.29%)
Mutual labels: requests
Magicpad
MagicPad is an encryption suite for beginners. It is designed to be run standalone via the browser or executable (Electron).
Stars: ✭ 174 (-0.57%)
Mutual labels: tor
Libhv
🔥 比libevent、libuv更易用的国产网络库。A c/c++ network library for developing TCP/UDP/SSL/HTTP/WebSocket client/server.
Stars: ✭ 3,355 (+1817.14%)
Mutual labels: requests
Scrapingoutsourcing
ScrapingOutsourcing专注分享爬虫代码 尽量每周更新一个
Stars: ✭ 164 (-6.29%)
Mutual labels: requests
TorRequest
A simple Python interface for HTTP(s) requests over Tor.
from torrequest import TorRequest
with TorRequest() as tr:
response = tr.get('http://ipecho.net/plain')
print(response.text) # not your IP address
It's basically a wrapper around Stem and Requests libraries.
Dependencies
You need Tor. It's available via Homebrew.
brew install tor
After installation, you may want to configure Tor by creating a .torrc
file in your $HOME
directory. More information is available on Tor
documentation.
Installation
After installing dependencies, you can install torrequest
via PyPI:
pip install torrequest
Examples
from torrequest import TorRequest
# Choose a proxy port, a control port, and a password.
# Defaults are 9050, 9051, and None respectively.
# If there is already a Tor process listening the specified
# ports, TorRequest will use that one.
# Otherwise, it will create a new Tor process,
# and terminate it at the end.
with TorRequest(proxy_port=9050, ctrl_port=9051, password=None) as tr:
# Specify HTTP verb and url.
resp = tr.get('http://google.com')
print(resp.text)
# Send data. Use basic authentication.
resp = tr.post('https://api.example.com',
data={'foo': 'bar'}, auth=('user', 'pass'))'
print(resp.json)
# Change your Tor circuit,
# and likely your observed IP address.
tr.reset_identity()
# TorRequest object also exposes the underlying Stem controller
# and Requests session objects for more flexibility.
print(type(tr.ctrl)) # a stem.control.Controller object
tr.ctrl.signal('CLEARDNSCACHE') # see Stem docs for the full API
print(type(tr.session)) # a requests.Session object
c = cookielib.CookieJar()
tr.session.cookies.update(c) # see Requests docs for the full API
License
MIT
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].