Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@ share/python-wheels/
*.egg
MANIFEST

# Virtual environments
.venv/

# Symlink
examples/growattServer
14 changes: 14 additions & 0 deletions growattServer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,17 @@
"Timespan",
"hash_password",
]


def __getattr__(name: str):
"""Lazy imports for async classes (requires httpx)."""
if name == "AsyncGrowattApi":
from .async_base_api import AsyncGrowattApi # noqa: PLC0415

return AsyncGrowattApi
if name == "AsyncOpenApiV1":
from .open_api_v1.async_open_api_v1 import AsyncOpenApiV1 # noqa: PLC0415

return AsyncOpenApiV1
msg = f"module {__name__!r} has no attribute {name!r}"
raise AttributeError(msg)
Loading
Loading