asyncio-telnet


Nameasyncio-telnet JSON
Version 0.1.21 PyPI version JSON
download
home_pagehttps://github.com/ForceFledgling/asyncio-telnet
SummaryAsyncio-based Telnet library
upload_time2023-11-26 21:57:03
maintainer
docs_urlNone
authorVladimir Penzin
requires_python>=3.6
license
keywords telnet tty asyncio synchronous asyncronous vty vtysh fast simple
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # **Python Telnet Utility: asyncio-powered**

The **asyncio-telnet** library designed for convenient interaction with Telnet devices in both synchronous and asynchronous modes, making the process straightforward and flexible in various usage scenarios.

[![Documentation](https://img.shields.io/badge/documentation-yes-brightgreen.svg)](docs) [![License: Apache License 2.0](https://img.shields.io/badge/License-Apache2-brightgreen.svg)](https://choosealicense.com/licenses/apache-2.0/) [![PyPi Version](https://img.shields.io/pypi/v/asyncio-telnet.svg?style=flat-square&logo=asyncio-telnet&logoColor=white)](https://pypi.org/project/asyncio-telnet/) [![PyPi downloads](https://static.pepy.tech/personalized-badge/asyncio-telnet?period=total&units=international_system&left_color=grey&right_color=orange&left_text=pip%20downloads)](https://pypistats.org/packages/asyncio-telnet)

- **Support for Asynchrony and Synchrony**: Harness the power of asyncio for efficient and non-blocking communication with Telnet servers. With this library, you have the option to choose between asynchronous and synchronous modes, depending on the requirements of your project.
- **Ease of Use**: The library provides a user-friendly interface for both synchronous and asynchronous cases, making it adaptable to different project needs.
- **Telnet Protocol Handling**: Transparently handles the intricacies of the Telnet protocol, allowing you to focus on the logic of your application.
- **Flexible Integration**: Easily integrate Telnet functionality into your Python applications with a simple API.

# Installation

You can install the library using pip. Make sure you have Python 3.6 or later installed.

`pip install asyncio-telnet`

# Usage

Example: Asynchronous Telnet Connection with Default Timeout

```python
import asyncio
from asyncio_telnet import Telnet

async def main():
    tn = Telnet()
    await tn.open('example.com')
    await tn.write(b'Vladimir\r\n')
    response = await tn.read_until_eof()
    await tn.close()
    return response

if __name__ == '__main__':
    result = asyncio.run(main())
    print(result)


# Example of successful execution:
# b'\n***************** User Access Login ********************\r\n\r\nUser:'
```

Example: Synchronous Telnet Connection

```python
from asyncio_telnet import Telnet

def main():
    tn = Telnet(sync_mode=True)
    tn.open('example.com')
    response = tn.read_until_eof()
    tn.close()
    return response

if __name__ == '__main__':
    result = main()
    print(result)


# Example of successful execution:
# b'\n***************** User Access Login ********************\r\n\r\nUser:'
```

Example: Asynchronous Telnet Connection with Custom Timeout.

By default, the timeout is set to 30 seconds.

```python
import asyncio
from asyncio_telnet import Telnet

async def main():
    tn = Telnet(timeout=5)
    try:
        await tn.open('example.com')
        response = await tn.read_until_eof()
        await tn.close()
        return response
    except ValueError as e:
        print(f"Example of a timeout occurrence: {e}")

if __name__ == '__main__':
    asyncio.run(main())


# Example response:
# Example of a timeout occurrence: Timeout connecting to example.com:23
```

Example: Asynchronous Telnet Connection with Write Operation

```python
import asyncio
from asyncio_telnet import Telnet

async def main():
    tn = Telnet()
    await tn.open('example.com')
    await tn.write(b'Vladimir\r\n')
    response = await tn.read_until_eof()
    await tn.close()
    return response

if __name__ == '__main__':
    result = asyncio.run(main())
    print(result)


# Example of successful execution:
# b'\n***************** User Access Login ********************\r\n\r\nUser:Vladimir\r\nPassword:'
```

Feel free to check the [documentation](docs) and [examples](examples) for more detailed information.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ForceFledgling/asyncio-telnet",
    "name": "asyncio-telnet",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "telnet tty asyncio synchronous asyncronous vty vtysh fast simple",
    "author": "Vladimir Penzin",
    "author_email": "pvenv@icloud.com",
    "download_url": "https://files.pythonhosted.org/packages/62/00/78cfda408e71dcab9038f9926411b80538bc0b366d6eb1c19f377c98eeba/asyncio-telnet-0.1.21.tar.gz",
    "platform": "any",
    "description": "# **Python Telnet Utility: asyncio-powered**\n\nThe **asyncio-telnet** library designed for convenient interaction with Telnet devices in both synchronous and asynchronous modes, making the process straightforward and flexible in various usage scenarios.\n\n[![Documentation](https://img.shields.io/badge/documentation-yes-brightgreen.svg)](docs) [![License: Apache License 2.0](https://img.shields.io/badge/License-Apache2-brightgreen.svg)](https://choosealicense.com/licenses/apache-2.0/) [![PyPi Version](https://img.shields.io/pypi/v/asyncio-telnet.svg?style=flat-square&logo=asyncio-telnet&logoColor=white)](https://pypi.org/project/asyncio-telnet/) [![PyPi downloads](https://static.pepy.tech/personalized-badge/asyncio-telnet?period=total&units=international_system&left_color=grey&right_color=orange&left_text=pip%20downloads)](https://pypistats.org/packages/asyncio-telnet)\n\n- **Support for Asynchrony and Synchrony**: Harness the power of asyncio for efficient and non-blocking communication with Telnet servers. With this library, you have the option to choose between asynchronous and synchronous modes, depending on the requirements of your project.\n- **Ease of Use**: The library provides a user-friendly interface for both synchronous and asynchronous cases, making it adaptable to different project needs.\n- **Telnet Protocol Handling**: Transparently handles the intricacies of the Telnet protocol, allowing you to focus on the logic of your application.\n- **Flexible Integration**: Easily integrate Telnet functionality into your Python applications with a simple API.\n\n# Installation\n\nYou can install the library using pip. Make sure you have Python 3.6 or later installed.\n\n`pip install asyncio-telnet`\n\n# Usage\n\nExample: Asynchronous Telnet Connection with Default Timeout\n\n```python\nimport asyncio\nfrom asyncio_telnet import Telnet\n\nasync def main():\n    tn = Telnet()\n    await tn.open('example.com')\n    await tn.write(b'Vladimir\\r\\n')\n    response = await tn.read_until_eof()\n    await tn.close()\n    return response\n\nif __name__ == '__main__':\n    result = asyncio.run(main())\n    print(result)\n\n\n# Example of successful execution:\n# b'\\n***************** User Access Login ********************\\r\\n\\r\\nUser:'\n```\n\nExample: Synchronous Telnet Connection\n\n```python\nfrom asyncio_telnet import Telnet\n\ndef main():\n    tn = Telnet(sync_mode=True)\n    tn.open('example.com')\n    response = tn.read_until_eof()\n    tn.close()\n    return response\n\nif __name__ == '__main__':\n    result = main()\n    print(result)\n\n\n# Example of successful execution:\n# b'\\n***************** User Access Login ********************\\r\\n\\r\\nUser:'\n```\n\nExample: Asynchronous Telnet Connection with Custom Timeout.\n\nBy default, the timeout is set to 30 seconds.\n\n```python\nimport asyncio\nfrom asyncio_telnet import Telnet\n\nasync def main():\n    tn = Telnet(timeout=5)\n    try:\n        await tn.open('example.com')\n        response = await tn.read_until_eof()\n        await tn.close()\n        return response\n    except ValueError as e:\n        print(f\"Example of a timeout occurrence: {e}\")\n\nif __name__ == '__main__':\n    asyncio.run(main())\n\n\n# Example response:\n# Example of a timeout occurrence: Timeout connecting to example.com:23\n```\n\nExample: Asynchronous Telnet Connection with Write Operation\n\n```python\nimport asyncio\nfrom asyncio_telnet import Telnet\n\nasync def main():\n    tn = Telnet()\n    await tn.open('example.com')\n    await tn.write(b'Vladimir\\r\\n')\n    response = await tn.read_until_eof()\n    await tn.close()\n    return response\n\nif __name__ == '__main__':\n    result = asyncio.run(main())\n    print(result)\n\n\n# Example of successful execution:\n# b'\\n***************** User Access Login ********************\\r\\n\\r\\nUser:Vladimir\\r\\nPassword:'\n```\n\nFeel free to check the [documentation](docs) and [examples](examples) for more detailed information.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Asyncio-based Telnet library",
    "version": "0.1.21",
    "project_urls": {
        "Homepage": "https://github.com/ForceFledgling/asyncio-telnet"
    },
    "split_keywords": [
        "telnet",
        "tty",
        "asyncio",
        "synchronous",
        "asyncronous",
        "vty",
        "vtysh",
        "fast",
        "simple"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7e658175a6dd07f7e45df26f931338a2994a90516889aa618b90fb61b1909318",
                "md5": "cacc7cd3ea0b03868ffe9a00490e73a6",
                "sha256": "ff96907f4f718f58fc99c7ff30ab05efb735061d9dc782877ec51ca358772b73"
            },
            "downloads": -1,
            "filename": "asyncio_telnet-0.1.21-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cacc7cd3ea0b03868ffe9a00490e73a6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 9857,
            "upload_time": "2023-11-26T21:57:01",
            "upload_time_iso_8601": "2023-11-26T21:57:01.528944Z",
            "url": "https://files.pythonhosted.org/packages/7e/65/8175a6dd07f7e45df26f931338a2994a90516889aa618b90fb61b1909318/asyncio_telnet-0.1.21-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "620078cfda408e71dcab9038f9926411b80538bc0b366d6eb1c19f377c98eeba",
                "md5": "d2cf857154067157b1c0dfa8ac1b6df0",
                "sha256": "d61ba2470111c144690275ba492539ccc63be8e4a0dd34f4327dd4dea188d0bd"
            },
            "downloads": -1,
            "filename": "asyncio-telnet-0.1.21.tar.gz",
            "has_sig": false,
            "md5_digest": "d2cf857154067157b1c0dfa8ac1b6df0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 9485,
            "upload_time": "2023-11-26T21:57:03",
            "upload_time_iso_8601": "2023-11-26T21:57:03.675463Z",
            "url": "https://files.pythonhosted.org/packages/62/00/78cfda408e71dcab9038f9926411b80538bc0b366d6eb1c19f377c98eeba/asyncio-telnet-0.1.21.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-26 21:57:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ForceFledgling",
    "github_project": "asyncio-telnet",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "asyncio-telnet"
}
        
Elapsed time: 2.16979s