https://github.com/linusgke/py2n
Python library for 2N® products
https://github.com/linusgke/py2n
2n intercom python
Last synced: about 1 month ago
JSON representation
Python library for 2N® products
- Host: GitHub
- URL: https://github.com/linusgke/py2n
- Owner: linusgke
- License: mit
- Created: 2022-12-30T17:10:58.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-15T23:16:12.000Z (about 1 year ago)
- Last Synced: 2025-12-16T20:17:33.826Z (3 months ago)
- Topics: 2n, intercom, python
- Language: Python
- Homepage: https://pypi.org/project/py2n/
- Size: 53.7 KB
- Stars: 5
- Watchers: 1
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Py2N

Asynchronous library to control [2N Telekomunikace® devices](https://www.2n.com)
**This library is under development**
## Requirements
- Python >= 3.9
- aiohttp >= 3.12.0
## Install
```bash
pip install py2n
```
## Example
```python
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",
# auth_method="digest", # default: "basic"
# protocol="https", # default: "http"
# ssl_verify=True, # default: False
),
)
await device.restart()
asyncio.run(main())
```
`auth_method` controls HTTP auth scheme and supports `"basic"` (default) and `"digest"`. Digest auth relies on `aiohttp.DigestAuthMiddleware`. 2N recommends Digest Auth, especially if using plain HTTP instead of HTTPS.
`ssl_verify` controls TLS certificate verification for HTTPS connections. Requires the device to present a trusted server certificate (e.g. Let's Encrypt).