Python package for an easy-to-use interaction with the Tor proxy and controlling IP address rotations.
Project description
# Tor Switch
Python package to interact with tor and control IP address rotations.
Installation
- install tor
sudo apt install tor
- install torswitch
pip3 install torswitch
Usage
from torswitch import TorProtocol
#Create your network
thisnetwork=TorProtocol()
#start your tor network
thisnetwork.Start()
#for changing your ip use
thisnetwork.NewTorIp()
"""
NewTorIP() just request for new ip, ip maybe or maybe not change
"""
#for getting absolute new ip use
thisnetwork.AbsoluteNewTorIp()
#for continues ip rotation use
thisnetwork.TorIpRotation(delay=3,limit=12)
"""
delay is to define the time gap(in seconds) between new ip address request.
limit is to define how many time you want to make request,default is 10
"""
#finally to stop tor
thisnetwork.stop()
Use tor as proxy
import requests
from torswitch import TorProtocol
thisnetwork=TorProtocol()
thisnetwork.Start()
proxies = {
'http': 'socks5://127.0.0.1:9050',
'https': 'socks5://127.0.0.1:9050'
}
proxy=requests.get('https://api.ipify.org',proxies=proxies).text
print(proxy)
thisnetwork.Stop()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
torswitch-2.0.1.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for torswitch-2.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 364bf9bab983065c478b0c9a90fb5ba9c0c75e2a02356aed7ed870867ae79cda |
|
MD5 | 40b28eee2983dcb5a3696ab4e05ad10d |
|
BLAKE2b-256 | 0816f8c98804eeb8c834b852bb47628c00c2c90c1a86f2cfe097e61ef222ac61 |