torswitch


Nametorswitch JSON
Version 2.0.1 PyPI version JSON
download
home_page
SummaryPython package for an easy-to-use interaction with the Tor proxy and controlling IP address rotations.
upload_time2023-04-10 14:46:12
maintainer
docs_urlNone
authorAlex Deathway
requires_python
license
keywords python tor pythontor onion ipaddress
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Tor Switch

<div align="center">
<img width="300" src="https://github.com/alexdeathway/torswitch/blob/master/assets/logo/ProjectLogo.png"  alt="logo"/>

[![Build and Publish Package](https://github.com/alexdeathway/torswitch/actions/workflows/build%20&%20publish.yaml/badge.svg)](https://github.com/alexdeathway/torswitch/actions/workflows/build%20&%20publish.yaml)
[![Python Package Test](https://github.com/alexdeathway/torswitch/actions/workflows/test.yaml/badge.svg)](https://github.com/alexdeathway/torswitch/actions/workflows/test.yaml)
[![PyPI version](https://img.shields.io/badge/dynamic/json?color=brightgreen&label=PyPI&query=$.info.version&url=https://pypi.org/pypi/torswitch/json)](https://pypi.org/project/torswitch/) [![License](https://img.shields.io/github/license/alexdeathway/torswitch.svg)](https://github.com/alexdeathway/torswitch/blob/main/LICENSE)


</div>

Python package to interact with tor and control IP address rotations.

## Installation 
 - install tor
 
 > sudo apt install tor

 - install torswitch

>  pip3 install torswitch

## Usage

```python
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
```python 

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()

```
--- 



            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "torswitch",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,tor,pythontor,onion,ipaddress",
    "author": "Alex Deathway",
    "author_email": "<alexdeathway@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/cd/e7/4c97e18026ab73b8ab4b56006276b4329cee8a5a463ed2c508e5c7b1c81d/torswitch-2.0.1.tar.gz",
    "platform": null,
    "description": "\n\ufeff# Tor Switch\n\n<div align=\"center\">\n<img width=\"300\" src=\"https://github.com/alexdeathway/torswitch/blob/master/assets/logo/ProjectLogo.png\"  alt=\"logo\"/>\n\n[![Build and Publish Package](https://github.com/alexdeathway/torswitch/actions/workflows/build%20&%20publish.yaml/badge.svg)](https://github.com/alexdeathway/torswitch/actions/workflows/build%20&%20publish.yaml)\n[![Python Package Test](https://github.com/alexdeathway/torswitch/actions/workflows/test.yaml/badge.svg)](https://github.com/alexdeathway/torswitch/actions/workflows/test.yaml)\n[![PyPI version](https://img.shields.io/badge/dynamic/json?color=brightgreen&label=PyPI&query=$.info.version&url=https://pypi.org/pypi/torswitch/json)](https://pypi.org/project/torswitch/) [![License](https://img.shields.io/github/license/alexdeathway/torswitch.svg)](https://github.com/alexdeathway/torswitch/blob/main/LICENSE)\n\n\n</div>\n\nPython package to interact with tor and control IP address rotations.\n\n## Installation \n - install tor\n \n > sudo apt install tor\n\n - install torswitch\n\n>  pip3 install torswitch\n\n## Usage\n\n```python\nfrom  torswitch  import  TorProtocol\n \n#Create your network\nthisnetwork=TorProtocol()\n\n#start your tor network\nthisnetwork.Start()\n\n#for changing your ip use\nthisnetwork.NewTorIp()\n\n\"\"\"\nNewTorIP() just request for new ip, ip maybe or maybe not change\n\"\"\"\n\n  \n\n#for getting absolute new ip use\nthisnetwork.AbsoluteNewTorIp()\n\n  \n\n#for continues ip rotation use\nthisnetwork.TorIpRotation(delay=3,limit=12)\n\n\"\"\"\ndelay is to define the time gap(in seconds) between new ip address request.\nlimit is to define how many time you want to make request,default is 10\n\"\"\"\n\n\n#finally to stop tor\nthisnetwork.stop()\n\n```\n\n## Use tor as proxy\n```python \n\nimport requests\nfrom torswitch import TorProtocol\n\nthisnetwork=TorProtocol()\nthisnetwork.Start()\n\nproxies = {\n    'http': 'socks5://127.0.0.1:9050',\n    'https': 'socks5://127.0.0.1:9050'\n}\n\nproxy=requests.get('https://api.ipify.org',proxies=proxies).text\nprint(proxy)\nthisnetwork.Stop()\n\n```\n--- \n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python package for an easy-to-use interaction with the Tor proxy and controlling IP address rotations.",
    "version": "2.0.1",
    "split_keywords": [
        "python",
        "tor",
        "pythontor",
        "onion",
        "ipaddress"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0816f8c98804eeb8c834b852bb47628c00c2c90c1a86f2cfe097e61ef222ac61",
                "md5": "40b28eee2983dcb5a3696ab4e05ad10d",
                "sha256": "364bf9bab983065c478b0c9a90fb5ba9c0c75e2a02356aed7ed870867ae79cda"
            },
            "downloads": -1,
            "filename": "torswitch-2.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "40b28eee2983dcb5a3696ab4e05ad10d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6039,
            "upload_time": "2023-04-10T14:46:11",
            "upload_time_iso_8601": "2023-04-10T14:46:11.700835Z",
            "url": "https://files.pythonhosted.org/packages/08/16/f8c98804eeb8c834b852bb47628c00c2c90c1a86f2cfe097e61ef222ac61/torswitch-2.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cde74c97e18026ab73b8ab4b56006276b4329cee8a5a463ed2c508e5c7b1c81d",
                "md5": "1a837792f8729b41b541c97152a62ed3",
                "sha256": "cbd153f980cdde629bb8c3cf773c5dad011d1651fd47a0bf1efce294f1fefd1c"
            },
            "downloads": -1,
            "filename": "torswitch-2.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1a837792f8729b41b541c97152a62ed3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5321,
            "upload_time": "2023-04-10T14:46:12",
            "upload_time_iso_8601": "2023-04-10T14:46:12.741533Z",
            "url": "https://files.pythonhosted.org/packages/cd/e7/4c97e18026ab73b8ab4b56006276b4329cee8a5a463ed2c508e5c7b1c81d/torswitch-2.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-10 14:46:12",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "torswitch"
}
        
Elapsed time: 0.07058s