Asyncio-based Telnet library
Project description
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.
- 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
Here is a simple example of using in an asynchronous context:
import asyncio
from asyncio_telnet import Telnet
async def main():
tn = Telnet()
await tn.open('example.com')
response = await tn.read_until_eof()
return response
if __name__ == '__main__':
result = asyncio.run(main())
print(result)
For synchronous usage, you can use the library in a similar way by simply specifying sync_mode=True:
from asyncio_telnet import Telnet
def main():
# by specifying sync_mode=True, a wrapper for calling asynchronous methods synchronously is activated internally.
tn = Telnet(sync_mode=True)
# now it is possible to directly invoke asynchronous methods through the wrapper
tn.open('example.com')
response = tn.read_until_eof()
return response
if __name__ == '__main__':
result = main()
print(result)
Feel free to check the documentation for more detailed information and examples.
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
Built Distribution
File details
Details for the file asyncio-telnet-0.1.13.tar.gz
.
File metadata
- Download URL: asyncio-telnet-0.1.13.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec6947c8f2e2152c894bffd55c0fc9bdf347e010d44463bc1f88ce819203cbec |
|
MD5 | 517fdf81f6d7fd9480b872dbc32e3691 |
|
BLAKE2b-256 | 05c7aecb8c0a3d6769b2176ea0fd0a612a3791a1b2194ea86dcff63eb38b2768 |
File details
Details for the file asyncio_telnet-0.1.13-py3-none-any.whl
.
File metadata
- Download URL: asyncio_telnet-0.1.13-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48302aadf1fdacefcdd193210f32a9ef868265e1b6f7bf44bd216f9bf0fad3e0 |
|
MD5 | 6b9104c7675361a9d0c14336779fbe48 |
|
BLAKE2b-256 | 6b67116e7cde691e91dbafbf3882535a726a8279591df1f3b8341fb499808604 |