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.2.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for torswitch-2.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2a1060d2b1eac5d7e8d9fb85c8891d7d28f5c21263e3db91121aa068cbd43e7 |
|
MD5 | da8fa40bec9fb3c4ee612a09a2c487a9 |
|
BLAKE2b-256 | 37c0bb67a391a6ad6658f3868f48b76db7be6eb95bb7497a123cee94dcd04e9c |