linusgke / py2n

Python library for 2N® products

Home Page:https://pypi.org/project/py2n/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Py2N

Asynchronous library to control 2N Telekomunikace® devices

This library is under development

Requirements

  • Python >= 3.9
  • aiohttp

Install

pip install py2n

Example

from py2n import Py2NDevice, Py2NConnectionData

import asyncio
import aiohttp

async def main():
    """Run with aiohttp ClientSession."""
    async with aiohttp.ClientSession() as session:
        await run(session)


async def run(websession):
    """Use library."""
    device = await Py2NDevice.create(
        websession,
        Py2NConnectionData(
            host="192.168.1.69",
            username="username",
            password="password",
        ),
    )

    await device.restart()

asyncio.run(main())

About

Python library for 2N® products

https://pypi.org/project/py2n/

License:MIT License


Languages

Language:Python 100.0%