quicnz 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,48 @@
1
+ weathermap.jpg
2
+
3
+ # Python
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+ *.so
8
+ *.pyd
9
+
10
+ # Distribution / packaging
11
+ .Python
12
+ build/
13
+ dist/
14
+ *.egg-info/
15
+ *.egg
16
+ .eggs/
17
+ wheels/
18
+ pip-wheel-metadata/
19
+ MANIFEST
20
+
21
+ # Virtual environments
22
+ .venv/
23
+ venv/
24
+ env/
25
+ .env
26
+
27
+ # Type checking
28
+ .mypy_cache/
29
+ .pytype/
30
+
31
+ # Testing
32
+ .pytest_cache/
33
+ .coverage
34
+ htmlcov/
35
+ .tox/
36
+
37
+ # Ruff
38
+ .ruff_cache/
39
+
40
+ # IDE
41
+ .vscode/
42
+ .idea/
43
+ *.swp
44
+ *.swo
45
+
46
+ # OS
47
+ .DS_Store
48
+ Thumbs.db
quicnz-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 quicnz contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
quicnz-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,191 @@
1
+ Metadata-Version: 2.4
2
+ Name: quicnz
3
+ Version: 0.1.0
4
+ Summary: Async Python library for the Quic broadband API (unofficial, not affiliated with Quic Broadband / Vetta Trading Ltd)
5
+ Project-URL: Homepage, https://github.com/quicnz/quicnz
6
+ Project-URL: Repository, https://github.com/quicnz/quicnz
7
+ Project-URL: Issues, https://github.com/quicnz/quicnz/issues
8
+ Author: Aurélien Geron
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: api,broadband,nz,quic
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: aiohttp>=3.9
23
+ Provides-Extra: dev
24
+ Requires-Dist: aioresponses>=0.7; extra == 'dev'
25
+ Requires-Dist: mypy>=1.10; extra == 'dev'
26
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
27
+ Requires-Dist: pytest>=8.0; extra == 'dev'
28
+ Requires-Dist: ruff>=0.4; extra == 'dev'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # quicnz
32
+
33
+ Async Python library for the [Quic broadband](https://quic.nz) API.
34
+
35
+ Quic exposes an API at `https://api.quic.nz/v1/` that gives customers access
36
+ to their service configuration, live session data (connection status, assigned
37
+ IP addresses, PPPoE/DHCP details), and a network weather map. This library
38
+ wraps that API with a clean, fully-typed async interface built on
39
+ [aiohttp](https://docs.aiohttp.org/).
40
+
41
+ > **Home Assistant integration:** A separate `ha-quicnz` custom integration
42
+ > that uses this library as a dependency is maintained in a different repository.
43
+
44
+ > **Disclaimer:** This project is an independent, community-maintained library
45
+ > and is **not affiliated with, endorsed by, or supported by Quic Broadband /
46
+ > Vetta Trading Ltd** in any way. Use it at your own risk.
47
+
48
+ ---
49
+
50
+ ## Requirements
51
+
52
+ - Python 3.11+
53
+ - aiohttp ≥ 3.9
54
+
55
+ ## Installation
56
+
57
+ ```bash
58
+ pip install quicnz
59
+ ```
60
+
61
+ ## Getting an API key
62
+
63
+ Log in to the [Quic portal](https://account.quic.nz/), navigate to **Settings**,
64
+ and generate an API key.
65
+
66
+ ## Quick start
67
+
68
+ ```python
69
+ import asyncio
70
+ from quicnz import QuicClient
71
+
72
+ async def main():
73
+ # api_key can also be supplied via the QUICNZ_API_KEY environment variable
74
+ async with QuicClient(api_key="YOUR_API_KEY") as client:
75
+ # List all services associated with your account
76
+ service_ids = await client.get_services()
77
+ print("Services:", service_ids)
78
+
79
+ # Fetch the active session for the first service
80
+ session = await client.get_session(service_ids[0])
81
+ print("Connected:", session.is_connected)
82
+ print("IPv4:", session.active_ipv4_prefix)
83
+ print("IPv6:", session.active_ipv6_prefix)
84
+ print("LFC:", session.service.lfc)
85
+
86
+ asyncio.run(main())
87
+ ```
88
+
89
+ Or omit `api_key` and set the environment variable instead:
90
+
91
+ ```bash
92
+ export QUICNZ_API_KEY="YOUR_API_KEY"
93
+ ```
94
+
95
+ ```python
96
+ async with QuicClient() as client:
97
+ ...
98
+ ```
99
+
100
+ ## Reusing an aiohttp session
101
+
102
+ If your application already manages an `aiohttp.ClientSession` you can pass it
103
+ in to avoid creating an extra connection pool:
104
+
105
+ ```python
106
+ import aiohttp
107
+ from quicnz import QuicClient
108
+
109
+ async with aiohttp.ClientSession() as http_session:
110
+ client = QuicClient(api_key="YOUR_API_KEY", session=http_session)
111
+ session = await client.get_session("service123")
112
+ ```
113
+
114
+ ## API reference
115
+
116
+ ### `QuicClient(api_key=None, *, session=None)`
117
+
118
+ Main entry point. Use as an async context manager or pass an existing
119
+ `aiohttp.ClientSession`. If `api_key` is omitted, the `QUICNZ_API_KEY`
120
+ environment variable is used. A `ValueError` is raised if neither is provided.
121
+
122
+ | Method | Returns | Description |
123
+ |---|---|---|
124
+ | `get_services()` | `list[str]` | Service IDs authorised for this API key |
125
+ | `get_session(service_id)` | `Session` | Active session for a service |
126
+ | `get_weathermap()` | `bytes` | JPEG bytes of the Quic network weather map |
127
+
128
+ ### `Session`
129
+
130
+ | Attribute | Type | Description |
131
+ |---|---|---|
132
+ | `status` | `str` | e.g. `"connected"` |
133
+ | `is_connected` | `bool` | `True` when `status == "connected"` |
134
+ | `session_type` | `str` | `"DHCP"` or `"PPPoE"` |
135
+ | `active_ipv4_prefix` | `str` | Assigned IPv4 address |
136
+ | `active_ipv4_prefix_length` | `int` | IPv4 prefix length |
137
+ | `active_ipv6_prefix` | `str` | Assigned IPv6 prefix |
138
+ | `active_ipv6_prefix_length` | `int` | IPv6 prefix length |
139
+ | `last_radius_update` | `datetime` | Last RADIUS accounting update |
140
+ | `session_expires_at` | `datetime` | When the session expires |
141
+ | `ppp_payload` | `PPPPayload \| None` | PPPoE session details (PPPoE only) |
142
+ | `service` | `ServiceInfo` | Static service configuration |
143
+ | `created_at` | `datetime` | |
144
+ | `updated_at` | `datetime` | |
145
+
146
+ ### `ServiceInfo`
147
+
148
+ | Attribute | Type | Description |
149
+ |---|---|---|
150
+ | `username` | `str` | PPPoE/DHCP username |
151
+ | `lfc` | `str` | Local Fibre Company (e.g. `"Chorus"`) |
152
+ | `status` | `str` | Service status (e.g. `"active"`) |
153
+ | `asid` | `str` | AS identifier |
154
+ | `datacap` | `float` | Data cap (0 = uncapped) |
155
+ | `static_ipv4_prefix` | `str` | Static IPv4 prefix (if any) |
156
+ | `static_ipv6_prefix` | `str` | Static IPv6 prefix (if any) |
157
+ | `routes` | `list[str]` | Announced routes |
158
+
159
+ ### Exceptions
160
+
161
+ | Exception | When raised |
162
+ |---|---|
163
+ | `QuicAuthError` | HTTP 403 – invalid or missing API key |
164
+ | `QuicNotFoundError` | HTTP 404 – resource not found |
165
+ | `QuicAPIError` | Any other HTTP error; has `.status: int` attribute |
166
+ | `QuicError` | Base class for all quicnz exceptions |
167
+
168
+ ## Rate limits
169
+
170
+ The Quic API enforces a limit of **120 requests per minute**. Session data is
171
+ cached server-side for 5 minutes; the weather map is cached for 6 minutes.
172
+
173
+ ## Development
174
+
175
+ ```bash
176
+ # Clone and install in editable mode with dev extras
177
+ git clone https://github.com/quicnz/quicnz
178
+ cd quicnz
179
+ pip install -e ".[dev]"
180
+
181
+ # Run tests
182
+ pytest
183
+
184
+ # Lint / type-check
185
+ ruff check src tests
186
+ mypy src
187
+ ```
188
+
189
+ ## Licence
190
+
191
+ [MIT](LICENSE)
quicnz-0.1.0/README.md ADDED
@@ -0,0 +1,161 @@
1
+ # quicnz
2
+
3
+ Async Python library for the [Quic broadband](https://quic.nz) API.
4
+
5
+ Quic exposes an API at `https://api.quic.nz/v1/` that gives customers access
6
+ to their service configuration, live session data (connection status, assigned
7
+ IP addresses, PPPoE/DHCP details), and a network weather map. This library
8
+ wraps that API with a clean, fully-typed async interface built on
9
+ [aiohttp](https://docs.aiohttp.org/).
10
+
11
+ > **Home Assistant integration:** A separate `ha-quicnz` custom integration
12
+ > that uses this library as a dependency is maintained in a different repository.
13
+
14
+ > **Disclaimer:** This project is an independent, community-maintained library
15
+ > and is **not affiliated with, endorsed by, or supported by Quic Broadband /
16
+ > Vetta Trading Ltd** in any way. Use it at your own risk.
17
+
18
+ ---
19
+
20
+ ## Requirements
21
+
22
+ - Python 3.11+
23
+ - aiohttp ≥ 3.9
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ pip install quicnz
29
+ ```
30
+
31
+ ## Getting an API key
32
+
33
+ Log in to the [Quic portal](https://account.quic.nz/), navigate to **Settings**,
34
+ and generate an API key.
35
+
36
+ ## Quick start
37
+
38
+ ```python
39
+ import asyncio
40
+ from quicnz import QuicClient
41
+
42
+ async def main():
43
+ # api_key can also be supplied via the QUICNZ_API_KEY environment variable
44
+ async with QuicClient(api_key="YOUR_API_KEY") as client:
45
+ # List all services associated with your account
46
+ service_ids = await client.get_services()
47
+ print("Services:", service_ids)
48
+
49
+ # Fetch the active session for the first service
50
+ session = await client.get_session(service_ids[0])
51
+ print("Connected:", session.is_connected)
52
+ print("IPv4:", session.active_ipv4_prefix)
53
+ print("IPv6:", session.active_ipv6_prefix)
54
+ print("LFC:", session.service.lfc)
55
+
56
+ asyncio.run(main())
57
+ ```
58
+
59
+ Or omit `api_key` and set the environment variable instead:
60
+
61
+ ```bash
62
+ export QUICNZ_API_KEY="YOUR_API_KEY"
63
+ ```
64
+
65
+ ```python
66
+ async with QuicClient() as client:
67
+ ...
68
+ ```
69
+
70
+ ## Reusing an aiohttp session
71
+
72
+ If your application already manages an `aiohttp.ClientSession` you can pass it
73
+ in to avoid creating an extra connection pool:
74
+
75
+ ```python
76
+ import aiohttp
77
+ from quicnz import QuicClient
78
+
79
+ async with aiohttp.ClientSession() as http_session:
80
+ client = QuicClient(api_key="YOUR_API_KEY", session=http_session)
81
+ session = await client.get_session("service123")
82
+ ```
83
+
84
+ ## API reference
85
+
86
+ ### `QuicClient(api_key=None, *, session=None)`
87
+
88
+ Main entry point. Use as an async context manager or pass an existing
89
+ `aiohttp.ClientSession`. If `api_key` is omitted, the `QUICNZ_API_KEY`
90
+ environment variable is used. A `ValueError` is raised if neither is provided.
91
+
92
+ | Method | Returns | Description |
93
+ |---|---|---|
94
+ | `get_services()` | `list[str]` | Service IDs authorised for this API key |
95
+ | `get_session(service_id)` | `Session` | Active session for a service |
96
+ | `get_weathermap()` | `bytes` | JPEG bytes of the Quic network weather map |
97
+
98
+ ### `Session`
99
+
100
+ | Attribute | Type | Description |
101
+ |---|---|---|
102
+ | `status` | `str` | e.g. `"connected"` |
103
+ | `is_connected` | `bool` | `True` when `status == "connected"` |
104
+ | `session_type` | `str` | `"DHCP"` or `"PPPoE"` |
105
+ | `active_ipv4_prefix` | `str` | Assigned IPv4 address |
106
+ | `active_ipv4_prefix_length` | `int` | IPv4 prefix length |
107
+ | `active_ipv6_prefix` | `str` | Assigned IPv6 prefix |
108
+ | `active_ipv6_prefix_length` | `int` | IPv6 prefix length |
109
+ | `last_radius_update` | `datetime` | Last RADIUS accounting update |
110
+ | `session_expires_at` | `datetime` | When the session expires |
111
+ | `ppp_payload` | `PPPPayload \| None` | PPPoE session details (PPPoE only) |
112
+ | `service` | `ServiceInfo` | Static service configuration |
113
+ | `created_at` | `datetime` | |
114
+ | `updated_at` | `datetime` | |
115
+
116
+ ### `ServiceInfo`
117
+
118
+ | Attribute | Type | Description |
119
+ |---|---|---|
120
+ | `username` | `str` | PPPoE/DHCP username |
121
+ | `lfc` | `str` | Local Fibre Company (e.g. `"Chorus"`) |
122
+ | `status` | `str` | Service status (e.g. `"active"`) |
123
+ | `asid` | `str` | AS identifier |
124
+ | `datacap` | `float` | Data cap (0 = uncapped) |
125
+ | `static_ipv4_prefix` | `str` | Static IPv4 prefix (if any) |
126
+ | `static_ipv6_prefix` | `str` | Static IPv6 prefix (if any) |
127
+ | `routes` | `list[str]` | Announced routes |
128
+
129
+ ### Exceptions
130
+
131
+ | Exception | When raised |
132
+ |---|---|
133
+ | `QuicAuthError` | HTTP 403 – invalid or missing API key |
134
+ | `QuicNotFoundError` | HTTP 404 – resource not found |
135
+ | `QuicAPIError` | Any other HTTP error; has `.status: int` attribute |
136
+ | `QuicError` | Base class for all quicnz exceptions |
137
+
138
+ ## Rate limits
139
+
140
+ The Quic API enforces a limit of **120 requests per minute**. Session data is
141
+ cached server-side for 5 minutes; the weather map is cached for 6 minutes.
142
+
143
+ ## Development
144
+
145
+ ```bash
146
+ # Clone and install in editable mode with dev extras
147
+ git clone https://github.com/quicnz/quicnz
148
+ cd quicnz
149
+ pip install -e ".[dev]"
150
+
151
+ # Run tests
152
+ pytest
153
+
154
+ # Lint / type-check
155
+ ruff check src tests
156
+ mypy src
157
+ ```
158
+
159
+ ## Licence
160
+
161
+ [MIT](LICENSE)
@@ -0,0 +1,39 @@
1
+ # Examples
2
+
3
+ These scripts demonstrate how to use the `quicnz` library.
4
+
5
+ ## API key setup
6
+
7
+ The examples read your Quic API key from `~/.quicnz_api.key`.
8
+
9
+ 1. Log in to the [Quic portal](https://account.quic.nz/), select a service, navigate to the bottom of the page, below your product details, and you should find your API key. If the field is empty, click "Roll API Key" to generate the key.
10
+
11
+ 2. Save it to the key file:
12
+
13
+ ```bash
14
+ echo "YOUR_API_KEY" > ~/.quicnz_api.key
15
+ ```
16
+
17
+ 3. Make sure to restrict permissions so only your user can read it:
18
+
19
+ ```bash
20
+ chmod og-rwx ~/.quicnz_api.key
21
+ ```
22
+
23
+ ## Running the examples
24
+
25
+ Install the library first:
26
+
27
+ ```bash
28
+ pip install quicnz
29
+ ```
30
+
31
+ Then run any example directly:
32
+
33
+ ```bash
34
+ python examples/list_services.py
35
+ python examples/session_status.py # uses your first service
36
+ python examples/session_status.py service123 # specify a service ID
37
+ python examples/download_weathermap.py # saves weathermap.jpg
38
+ python examples/download_weathermap.py ~/map.jpg # custom output path
39
+ ```
@@ -0,0 +1,48 @@
1
+ """Shared helper: load the Quic API key for example scripts.
2
+
3
+ The key is read from ~/.quicnz_api.key (plain text, one line).
4
+ If that file does not exist, the QUICNZ_API_KEY environment variable is used
5
+ as a fallback.
6
+
7
+ See examples/README.md for setup instructions.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import os
13
+ import stat
14
+ import sys
15
+ from pathlib import Path
16
+
17
+ _KEY_FILE = Path("~/.quicnz_api.key").expanduser()
18
+
19
+
20
+ def load_api_key() -> str:
21
+ """Return the API key, or exit with a helpful message if it cannot be found."""
22
+ if _KEY_FILE.exists():
23
+ _warn_if_permissive(_KEY_FILE)
24
+ key = _KEY_FILE.read_text().strip()
25
+ if key:
26
+ return key
27
+
28
+ env_key = os.environ.get("QUICNZ_API_KEY", "").strip()
29
+ if env_key:
30
+ return env_key
31
+
32
+ sys.exit(
33
+ f"No API key found.\n"
34
+ f" Create {_KEY_FILE} containing your Quic API key, then run:\n"
35
+ f" chmod og-rwx {_KEY_FILE}\n"
36
+ f" Or set the QUICNZ_API_KEY environment variable."
37
+ )
38
+
39
+
40
+ def _warn_if_permissive(path: Path) -> None:
41
+ """Warn when the key file is readable by group or others."""
42
+ mode = path.stat().st_mode
43
+ if mode & (stat.S_IRGRP | stat.S_IWGRP | stat.S_IROTH | stat.S_IWOTH):
44
+ print(
45
+ f"Warning: {path} is readable by others. "
46
+ f"Run: chmod og-rwx {path}",
47
+ file=sys.stderr,
48
+ )
@@ -0,0 +1,29 @@
1
+ """Download the Quic network weather map and save it as a JPEG file.
2
+
3
+ Usage:
4
+ python download_weathermap.py # saves to weathermap.jpg
5
+ python download_weathermap.py ~/map.jpg # custom output path
6
+ """
7
+
8
+ import asyncio
9
+ import sys
10
+ from pathlib import Path
11
+
12
+ from quicnz import QuicClient
13
+
14
+ from _auth import load_api_key
15
+
16
+ DEFAULT_OUTPUT = Path("weathermap.jpg")
17
+
18
+
19
+ async def main(output: Path) -> None:
20
+ async with QuicClient(api_key=load_api_key()) as client:
21
+ data = await client.get_weathermap()
22
+
23
+ output.write_bytes(data)
24
+ print(f"Weather map saved to {output} ({len(data):,} bytes)")
25
+
26
+
27
+ if __name__ == "__main__":
28
+ out = Path(sys.argv[1]).expanduser() if len(sys.argv) > 1 else DEFAULT_OUTPUT
29
+ asyncio.run(main(out))
@@ -0,0 +1,24 @@
1
+ """List all service IDs associated with your Quic account."""
2
+
3
+ import asyncio
4
+
5
+ from quicnz import QuicClient
6
+
7
+ from _auth import load_api_key
8
+
9
+
10
+ async def main() -> None:
11
+ async with QuicClient(api_key=load_api_key()) as client:
12
+ service_ids = await client.get_services()
13
+
14
+ if not service_ids:
15
+ print("No services found for this API key.")
16
+ return
17
+
18
+ print(f"Found {len(service_ids)} service(s):")
19
+ for sid in service_ids:
20
+ print(f" {sid}")
21
+
22
+
23
+ if __name__ == "__main__":
24
+ asyncio.run(main())
@@ -0,0 +1,71 @@
1
+ """Show the active session status for a Quic service.
2
+
3
+ Usage:
4
+ python session_status.py # uses the first service on your account
5
+ python session_status.py <service-id> # specify a service ID explicitly
6
+ """
7
+
8
+ import asyncio
9
+ import sys
10
+ from datetime import timezone
11
+
12
+ from quicnz import QuicClient, QuicNotFoundError
13
+
14
+ from _auth import load_api_key
15
+
16
+
17
+ async def main(service_id: str | None) -> None:
18
+ async with QuicClient(api_key=load_api_key()) as client:
19
+ if service_id is None:
20
+ service_ids = await client.get_services()
21
+ if not service_ids:
22
+ sys.exit("No services found for this API key.")
23
+ service_id = service_ids[0]
24
+ if len(service_ids) > 1:
25
+ print(f"Multiple services found; showing first: {service_id}")
26
+
27
+ try:
28
+ session = await client.get_session(service_id)
29
+ except QuicNotFoundError:
30
+ sys.exit(f"No active session found for service '{service_id}'.")
31
+
32
+ # ---- service configuration ----
33
+ svc = session.service
34
+ print(f"Service ID : {service_id}")
35
+ print(f"LFC : {svc.lfc}")
36
+ print(f"Entity : {svc.entity} (ID: {svc.entity_unique_id})")
37
+ print(f"Service status: {svc.status}")
38
+ print(f"Username : {svc.username}")
39
+ if svc.datacap:
40
+ print(f"Data cap : {svc.datacap} GB")
41
+ else:
42
+ print(f"Data cap : uncapped")
43
+
44
+ # ---- session ----
45
+ print()
46
+ connected = "YES" if session.is_connected else "NO"
47
+ print(f"Connected : {connected} ({session.status})")
48
+ print(f"Session type : {session.session_type}")
49
+ print(f"IPv4 address : {session.active_ipv4_prefix}/{session.active_ipv4_prefix_length}")
50
+ print(f"IPv6 prefix : {session.active_ipv6_prefix}/{session.active_ipv6_prefix_length}")
51
+
52
+ local_expires = session.session_expires_at.astimezone()
53
+ print(f"Session expires : {local_expires.strftime('%Y-%m-%d %H:%M:%S %Z')}")
54
+
55
+ local_updated = session.last_radius_update.astimezone()
56
+ print(f"Last RADIUS update: {local_updated.strftime('%Y-%m-%d %H:%M:%S %Z')}")
57
+
58
+ # ---- PPPoE details (if present) ----
59
+ if session.ppp_payload:
60
+ ppp = session.ppp_payload
61
+ print()
62
+ print("PPPoE details:")
63
+ print(f" NAS identifier : {ppp.nas_identifier}")
64
+ print(f" Circuit ID : {ppp.adsl_agent_circuit_id}")
65
+ print(f" Remote ID : {ppp.adsl_agent_remote_id}")
66
+ print(f" Calling station : {ppp.calling_station_id}")
67
+
68
+
69
+ if __name__ == "__main__":
70
+ arg = sys.argv[1] if len(sys.argv) > 1 else None
71
+ asyncio.run(main(arg))
@@ -0,0 +1,62 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "quicnz"
7
+ version = "0.1.0"
8
+ description = "Async Python library for the Quic broadband API (unofficial, not affiliated with Quic Broadband / Vetta Trading Ltd)"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.11"
12
+ authors = [
13
+ { name = "Aurélien Geron" },
14
+ ]
15
+ keywords = ["quic", "broadband", "nz", "api"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Topic :: Software Development :: Libraries :: Python Modules",
25
+ "Typing :: Typed",
26
+ ]
27
+ dependencies = [
28
+ "aiohttp>=3.9",
29
+ ]
30
+
31
+ [project.urls]
32
+ Homepage = "https://github.com/quicnz/quicnz"
33
+ Repository = "https://github.com/quicnz/quicnz"
34
+ Issues = "https://github.com/quicnz/quicnz/issues"
35
+
36
+ [project.optional-dependencies]
37
+ dev = [
38
+ "pytest>=8.0",
39
+ "pytest-asyncio>=0.23",
40
+ "aioresponses>=0.7",
41
+ "ruff>=0.4",
42
+ "mypy>=1.10",
43
+ ]
44
+
45
+ [tool.hatch.build.targets.wheel]
46
+ packages = ["src/quicnz"]
47
+
48
+ [tool.pytest.ini_options]
49
+ asyncio_mode = "auto"
50
+ testpaths = ["tests"]
51
+
52
+ [tool.ruff]
53
+ target-version = "py311"
54
+ line-length = 100
55
+
56
+ [tool.ruff.lint]
57
+ select = ["E", "F", "I", "UP", "B", "SIM"]
58
+
59
+ [tool.mypy]
60
+ python_version = "3.11"
61
+ strict = true
62
+ files = ["src"]