pyopengate 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,21 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.12", "3.13"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: astral-sh/setup-uv@v5
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - run: uv sync --extra dev
20
+ - run: uv run ruff check src tests
21
+ - run: uv run pytest -v
@@ -0,0 +1,17 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: astral-sh/setup-uv@v5
16
+ - run: uv build
17
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,8 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ dist/
4
+ build/
5
+ *.egg-info/
6
+ .pytest_cache/
7
+ .ruff_cache/
8
+ .venv/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ben Tekkie
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.
@@ -0,0 +1,92 @@
1
+ Metadata-Version: 2.5
2
+ Name: pyopengate
3
+ Version: 0.1.0
4
+ Summary: Async Python client library for the OpenGate gate-opening API.
5
+ Project-URL: Homepage, https://github.com/bentekkie/pyopengate
6
+ Project-URL: Repository, https://github.com/bentekkie/pyopengate
7
+ Project-URL: Issues, https://github.com/bentekkie/pyopengate/issues
8
+ Author: Ben Tekkie
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: aiohttp,async,gate,home-assistant,opengate,smart-home
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Home Automation
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.12
22
+ Requires-Dist: aiohttp>=3.9.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
25
+ Requires-Dist: pytest>=8.0; extra == 'dev'
26
+ Requires-Dist: ruff>=0.6; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # pyopengate
30
+
31
+ Async Python client library for the [OpenGate](https://opengate.io) cellular and parking gate opening API (`https://api.opengate.io`).
32
+
33
+ Built with `aiohttp` and typed dataclasses, designed for standalone automation scripts and the [ha-opengate](https://github.com/bentekkie/ha-opengate) Home Assistant Marketplace integration.
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ pip install pyopengate
39
+ ```
40
+
41
+ ## Quick Start
42
+
43
+ ### Authenticate with SMS OTP
44
+
45
+ ```python
46
+ import asyncio
47
+ from pyopengate import OpenGateClient
48
+
49
+ async def main() -> None:
50
+ async with OpenGateClient() as client:
51
+ await client.async_generate_sms_code(ext="972", phone="0501234567")
52
+ code = input("Enter SMS OTP code: ")
53
+ profile = await client.async_verify_sms_code(
54
+ ext="972",
55
+ phone="0501234567",
56
+ sms_code=code,
57
+ )
58
+ print("Authenticated uqid:", profile["uqid"])
59
+
60
+ asyncio.run(main())
61
+ ```
62
+
63
+ ### List Gates & Trigger Opening
64
+
65
+ ```python
66
+ import asyncio
67
+ from pyopengate import OpenGateClient
68
+
69
+ async def main() -> None:
70
+ async with OpenGateClient(uqid="YOUR_UQID") as client:
71
+ snapshot = await client.async_fetch_snapshot()
72
+ for gate in snapshot.gates.values():
73
+ print(gate.gate_id, gate.name, gate.address_name)
74
+
75
+ first_gate = next(iter(snapshot.gates.values()))
76
+ await client.async_call_gate(first_gate.gate_id)
77
+
78
+ asyncio.run(main())
79
+ ```
80
+
81
+ ## Supported Features
82
+
83
+ - SMS OTP login (`/sms/generateSmsCode`, `/sms/verifySmsCode`) and session validation (`/customers/isLogged`)
84
+ - Typed account snapshot parsing (`/addresses`, `/gates`, `/gates/callHistory/<gatePhone>`)
85
+ - Remote gate triggering (`/gates/callNow`) with typed rejection errors (`trialEnd`, `blocked`, `gateNotClooseToAddress`, `clocksModeIsActive_protectGate`, `limitedCallDistance`)
86
+ - Parking lot gate triggering (`/parkinglots/opengate`)
87
+ - Manager actions: authorized customers and parking managers management
88
+ - Client-side 1 req/sec `POST` throttling matching the OpenGate mobile client
89
+
90
+ ## License
91
+
92
+ MIT
@@ -0,0 +1,64 @@
1
+ # pyopengate
2
+
3
+ Async Python client library for the [OpenGate](https://opengate.io) cellular and parking gate opening API (`https://api.opengate.io`).
4
+
5
+ Built with `aiohttp` and typed dataclasses, designed for standalone automation scripts and the [ha-opengate](https://github.com/bentekkie/ha-opengate) Home Assistant Marketplace integration.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install pyopengate
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ### Authenticate with SMS OTP
16
+
17
+ ```python
18
+ import asyncio
19
+ from pyopengate import OpenGateClient
20
+
21
+ async def main() -> None:
22
+ async with OpenGateClient() as client:
23
+ await client.async_generate_sms_code(ext="972", phone="0501234567")
24
+ code = input("Enter SMS OTP code: ")
25
+ profile = await client.async_verify_sms_code(
26
+ ext="972",
27
+ phone="0501234567",
28
+ sms_code=code,
29
+ )
30
+ print("Authenticated uqid:", profile["uqid"])
31
+
32
+ asyncio.run(main())
33
+ ```
34
+
35
+ ### List Gates & Trigger Opening
36
+
37
+ ```python
38
+ import asyncio
39
+ from pyopengate import OpenGateClient
40
+
41
+ async def main() -> None:
42
+ async with OpenGateClient(uqid="YOUR_UQID") as client:
43
+ snapshot = await client.async_fetch_snapshot()
44
+ for gate in snapshot.gates.values():
45
+ print(gate.gate_id, gate.name, gate.address_name)
46
+
47
+ first_gate = next(iter(snapshot.gates.values()))
48
+ await client.async_call_gate(first_gate.gate_id)
49
+
50
+ asyncio.run(main())
51
+ ```
52
+
53
+ ## Supported Features
54
+
55
+ - SMS OTP login (`/sms/generateSmsCode`, `/sms/verifySmsCode`) and session validation (`/customers/isLogged`)
56
+ - Typed account snapshot parsing (`/addresses`, `/gates`, `/gates/callHistory/<gatePhone>`)
57
+ - Remote gate triggering (`/gates/callNow`) with typed rejection errors (`trialEnd`, `blocked`, `gateNotClooseToAddress`, `clocksModeIsActive_protectGate`, `limitedCallDistance`)
58
+ - Parking lot gate triggering (`/parkinglots/opengate`)
59
+ - Manager actions: authorized customers and parking managers management
60
+ - Client-side 1 req/sec `POST` throttling matching the OpenGate mobile client
61
+
62
+ ## License
63
+
64
+ MIT
@@ -0,0 +1,57 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.25.0"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "pyopengate"
7
+ version = "0.1.0"
8
+ description = "Async Python client library for the OpenGate gate-opening API."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.12"
12
+ authors = [
13
+ { name = "Ben Tekkie" },
14
+ ]
15
+ keywords = ["opengate", "gate", "smart-home", "home-assistant", "async", "aiohttp"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Topic :: Home Automation",
25
+ "Typing :: Typed",
26
+ ]
27
+ dependencies = [
28
+ "aiohttp>=3.9.0",
29
+ ]
30
+
31
+ [project.optional-dependencies]
32
+ dev = [
33
+ "pytest>=8.0",
34
+ "pytest-asyncio>=0.24",
35
+ "ruff>=0.6",
36
+ ]
37
+
38
+ [project.urls]
39
+ Homepage = "https://github.com/bentekkie/pyopengate"
40
+ Repository = "https://github.com/bentekkie/pyopengate"
41
+ Issues = "https://github.com/bentekkie/pyopengate/issues"
42
+
43
+ [tool.hatch.build.targets.wheel]
44
+ packages = ["src/pyopengate"]
45
+
46
+ [tool.pytest.ini_options]
47
+ testpaths = ["tests"]
48
+ asyncio_mode = "auto"
49
+ asyncio_default_fixture_loop_scope = "function"
50
+
51
+ [tool.ruff]
52
+ target-version = "py312"
53
+ line-length = 100
54
+ src = ["src", "tests"]
55
+
56
+ [tool.ruff.lint]
57
+ select = ["E", "F", "I", "UP", "B", "SIM"]
@@ -0,0 +1,48 @@
1
+ """Async Python client library for the OpenGate gate-opening API."""
2
+
3
+ from .client import OpenGateClient
4
+ from .const import (
5
+ API_BASE_URL,
6
+ CALL_ERROR_MESSAGES,
7
+ DEFAULT_DEVICE_TYPE,
8
+ DEFAULT_DEVICE_VERSION,
9
+ DEFAULT_EXT,
10
+ DEFAULT_PLATFORM,
11
+ PARKING_LOT_ERROR_MESSAGES,
12
+ SUBSCRIPTION_LABELS,
13
+ )
14
+ from .exceptions import (
15
+ OpenGateAuthError,
16
+ OpenGateCallError,
17
+ OpenGateConnectionError,
18
+ OpenGateError,
19
+ )
20
+ from .models import (
21
+ OpenGateAccountSnapshot,
22
+ OpenGateAddress,
23
+ OpenGateCallRecord,
24
+ OpenGateGate,
25
+ )
26
+
27
+ __version__ = "0.1.0"
28
+
29
+ __all__ = [
30
+ "API_BASE_URL",
31
+ "CALL_ERROR_MESSAGES",
32
+ "DEFAULT_DEVICE_TYPE",
33
+ "DEFAULT_DEVICE_VERSION",
34
+ "DEFAULT_EXT",
35
+ "DEFAULT_PLATFORM",
36
+ "PARKING_LOT_ERROR_MESSAGES",
37
+ "SUBSCRIPTION_LABELS",
38
+ "OpenGateAccountSnapshot",
39
+ "OpenGateAddress",
40
+ "OpenGateAuthError",
41
+ "OpenGateCallError",
42
+ "OpenGateCallRecord",
43
+ "OpenGateClient",
44
+ "OpenGateConnectionError",
45
+ "OpenGateError",
46
+ "OpenGateGate",
47
+ "__version__",
48
+ ]