Skip to content

linusgke/py2n

Folders and files

NameName
Last commit message
Last commit date

Latest commit

6d78bfc · Jan 15, 2025

History

45 Commits
Jan 27, 2023
Dec 31, 2022
Sep 9, 2024
Dec 30, 2022
Dec 30, 2022
Jun 19, 2023
Jan 15, 2025

Repository files navigation

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