Skip to content

Commit

Permalink
Add APIType to client
Browse files Browse the repository at this point in the history
  • Loading branch information
iMicknl committed Jun 25, 2023
1 parent 379df32 commit b2dcf81
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pyoverkiz/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from botocore.config import Config
from warrant_lite import WarrantLite

from pyoverkiz.enums import APIType
from pyoverkiz.const import (
COZYTOUCH_ATLANTIC_API,
COZYTOUCH_CLIENT_ID,
Expand Down Expand Up @@ -95,6 +96,7 @@ class OverkizClient:
gateways: list[Gateway]
event_listener_id: str | None
session: ClientSession
api_type: APIType

_refresh_token: str | None = None
_expires_in: datetime.datetime | None = None
Expand Down Expand Up @@ -129,6 +131,12 @@ def __init__(

self.session = session if session else ClientSession()

self.api_type = (
APIType.LOCAL
if "/enduser-mobile-web/1/enduserAPI/" in self.server.endpoint
else APIType.CLOUD
)

async def __aenter__(self) -> OverkizClient:
return self

Expand Down
1 change: 1 addition & 0 deletions pyoverkiz/enums/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# flake8: noqa: F401, F403

from .api import *
from .command import *
from .execution import *
from .gateway import *
Expand Down
7 changes: 7 additions & 0 deletions pyoverkiz/enums/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from enum import Enum, unique


@unique
class APIType(str, Enum):
CLOUD = "cloud"
LOCAL = "local"

0 comments on commit b2dcf81

Please sign in to comment.