Skip to content

Commit 812ce78

Browse files
committed
Rename server as client
1 parent fb85fc9 commit 812ce78

File tree

7 files changed

+35
-34
lines changed

7 files changed

+35
-34
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ PASSWORD = ""
4747
async def main() -> None:
4848

4949
session = ClientSession()
50-
server = SUPPORTED_SERVERS["somfy_europe"](session)
51-
async with server as client:
50+
client = SUPPORTED_SERVERS["somfy_europe"](session)
51+
async with client as client:
5252
try:
5353
await client.login(USERNAME, PASSWORD)
5454
except Exception as exception: # pylint: disable=broad-except
@@ -69,6 +69,7 @@ async def main() -> None:
6969

7070

7171
asyncio.run(main())
72+
7273
```
7374

7475
## Development

pyoverkiz/servers/atlantic_cozytouch.py renamed to pyoverkiz/clients/atlantic_cozytouch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
from aiohttp import FormData
44

5+
from pyoverkiz.clients.overkiz import OverkizClient
56
from pyoverkiz.exceptions import (
67
CozyTouchBadCredentialsException,
78
CozyTouchServiceException,
89
)
9-
from pyoverkiz.servers.overkiz_server import OverkizServer
1010

1111
COZYTOUCH_ATLANTIC_API = "https://apis.groupe-atlantic.com"
1212
COZYTOUCH_CLIENT_ID = (
1313
"Q3RfMUpWeVRtSUxYOEllZkE3YVVOQmpGblpVYToyRWNORHpfZHkzNDJVSnFvMlo3cFNKTnZVdjBh"
1414
)
1515

1616

17-
class AtlanticCozytouch(OverkizServer):
17+
class AtlanticCozytouchClient(OverkizClient):
1818
async def _login(self, username: str, password: str) -> bool:
1919
"""
2020
Authenticate and create an API session allowing access to the other operations.

pyoverkiz/servers/default.py renamed to pyoverkiz/clients/default.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from pyoverkiz.servers.overkiz_server import OverkizServer
1+
from pyoverkiz.clients.overkiz import OverkizClient
22

33

4-
class DefaultServer(OverkizServer):
4+
class DefaultClient(OverkizClient):
55
async def _login(self, username: str, password: str) -> bool:
66
"""
77
Authenticate and create an API session allowing access to the other operations.

pyoverkiz/servers/nexity.py renamed to pyoverkiz/clients/nexity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
from botocore.config import Config
88
from warrant_lite import WarrantLite
99

10+
from pyoverkiz.clients.overkiz import OverkizClient
1011
from pyoverkiz.exceptions import NexityBadCredentialsException, NexityServiceException
11-
from pyoverkiz.servers.overkiz_server import OverkizServer
1212

1313
NEXITY_API = "https://api.egn.prd.aws-nexity.fr"
1414
NEXITY_COGNITO_CLIENT_ID = "3mca95jd5ase5lfde65rerovok"
1515
NEXITY_COGNITO_USER_POOL = "eu-west-1_wj277ucoI"
1616
NEXITY_COGNITO_REGION = "eu-west-1"
1717

1818

19-
class NexityServer(OverkizServer):
19+
class NexityClient(OverkizClient):
2020
async def _login(self, username: str, password: str) -> bool:
2121
"""
2222
Authenticate and create an API session allowing access to the other operations.

pyoverkiz/servers/overkiz_server.py renamed to pyoverkiz/clients/overkiz.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Python wrapper for the OverKiz API """
1+
""" Python wrapper for the OverKiz API"""
22

33
from __future__ import annotations
44

@@ -59,8 +59,8 @@ async def refresh_listener(invocation: Mapping[str, Any]) -> None:
5959

6060

6161
@define(kw_only=True)
62-
class OverkizServer(ABC):
63-
"""Interface class for the Overkiz API"""
62+
class OverkizClient(ABC):
63+
"""Abstract class for the Overkiz API"""
6464

6565
# username: str
6666
# password: str = field(repr=lambda _: "***")
@@ -134,7 +134,7 @@ async def delete(self, path: str) -> None:
134134
) as response:
135135
await self.check_response(response)
136136

137-
async def __aenter__(self) -> OverkizServer:
137+
async def __aenter__(self) -> OverkizClient:
138138
return self
139139

140140
async def __aexit__(

pyoverkiz/servers/somfy.py renamed to pyoverkiz/clients/somfy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55

66
from aiohttp import FormData
77

8+
from pyoverkiz.clients.overkiz import OverkizClient
89
from pyoverkiz.exceptions import SomfyBadCredentialsException, SomfyServiceException
9-
from pyoverkiz.servers.overkiz_server import OverkizServer
1010
from pyoverkiz.types import JSON
1111

1212
SOMFY_API = "https://accounts.somfy.com"
1313
SOMFY_CLIENT_ID = "0d8e920c-1478-11e7-a377-02dd59bd3041_1ewvaqmclfogo4kcsoo0c8k4kso884owg08sg8c40sk4go4ksg"
1414
SOMFY_CLIENT_SECRET = "12k73w1n540g8o4cokg0cw84cog840k84cwggscwg884004kgk"
1515

1616

17-
class SomfyServer(OverkizServer):
17+
class SomfyClient(OverkizClient):
1818

1919
_access_token: str | None = None
2020
_refresh_token: str | None = None

pyoverkiz/const.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,105 +4,105 @@
44

55
from aiohttp import ClientSession
66

7-
from pyoverkiz.servers.atlantic_cozytouch import AtlanticCozytouch
8-
from pyoverkiz.servers.default import DefaultServer
9-
from pyoverkiz.servers.nexity import NexityServer
10-
from pyoverkiz.servers.overkiz_server import OverkizServer
11-
from pyoverkiz.servers.somfy import SomfyServer
7+
from pyoverkiz.clients.atlantic_cozytouch import AtlanticCozytouchClient
8+
from pyoverkiz.clients.default import DefaultClient
9+
from pyoverkiz.clients.nexity import NexityClient
10+
from pyoverkiz.clients.overkiz import OverkizClient
11+
from pyoverkiz.clients.somfy import SomfyClient
1212

13-
SUPPORTED_SERVERS: dict[str, Callable[[ClientSession], OverkizServer]] = {
14-
"atlantic_cozytouch": lambda session: AtlanticCozytouch(
13+
SUPPORTED_SERVERS: dict[str, Callable[[ClientSession], OverkizClient]] = {
14+
"atlantic_cozytouch": lambda session: AtlanticCozytouchClient(
1515
name="Atlantic Cozytouch",
1616
endpoint="https://ha110-1.overkiz.com/enduser-mobile-web/enduserAPI/",
1717
manufacturer="Atlantic",
1818
configuration_url=None,
1919
session=session,
2020
),
21-
"brandt": lambda session: DefaultServer(
21+
"brandt": lambda session: DefaultClient(
2222
name="Brandt Smart Control",
2323
endpoint="https://ha3-1.overkiz.com/enduser-mobile-web/enduserAPI/",
2424
manufacturer="Brandt",
2525
configuration_url=None,
2626
session=session,
2727
),
28-
"flexom": lambda session: DefaultServer(
28+
"flexom": lambda session: DefaultClient(
2929
name="Flexom",
3030
endpoint="https://ha108-1.overkiz.com/enduser-mobile-web/enduserAPI/",
3131
manufacturer="Bouygues",
3232
configuration_url=None,
3333
session=session,
3434
),
35-
"hexaom_hexaconnect": lambda session: DefaultServer(
35+
"hexaom_hexaconnect": lambda session: DefaultClient(
3636
name="Hexaom HexaConnect",
3737
endpoint="https://ha5-1.overkiz.com/enduser-mobile-web/enduserAPI/",
3838
manufacturer="Hexaom",
3939
configuration_url=None,
4040
session=session,
4141
),
42-
"hi_kumo_asia": lambda session: DefaultServer(
42+
"hi_kumo_asia": lambda session: DefaultClient(
4343
name="Hitachi Hi Kumo (Asia)",
4444
endpoint="https://ha203-1.overkiz.com/enduser-mobile-web/enduserAPI/",
4545
manufacturer="Hitachi",
4646
configuration_url=None,
4747
session=session,
4848
),
49-
"hi_kumo_europe": lambda session: DefaultServer(
49+
"hi_kumo_europe": lambda session: DefaultClient(
5050
name="Hitachi Hi Kumo (Europe)",
5151
endpoint="https://ha117-1.overkiz.com/enduser-mobile-web/enduserAPI/",
5252
manufacturer="Hitachi",
5353
configuration_url=None,
5454
session=session,
5555
),
56-
"hi_kumo_oceania": lambda session: DefaultServer(
56+
"hi_kumo_oceania": lambda session: DefaultClient(
5757
name="Hitachi Hi Kumo (Oceania)",
5858
endpoint="https://ha203-1.overkiz.com/enduser-mobile-web/enduserAPI/",
5959
manufacturer="Hitachi",
6060
configuration_url=None,
6161
session=session,
6262
),
63-
"nexity": lambda session: NexityServer(
63+
"nexity": lambda session: NexityClient(
6464
name="Nexity Eugénie",
6565
endpoint="https://ha106-1.overkiz.com/enduser-mobile-web/enduserAPI/",
6666
manufacturer="Nexity",
6767
configuration_url=None,
6868
session=session,
6969
),
70-
"rexel": lambda session: DefaultServer(
70+
"rexel": lambda session: DefaultClient(
7171
name="Rexel Energeasy Connect",
7272
endpoint="https://ha112-1.overkiz.com/enduser-mobile-web/enduserAPI/",
7373
manufacturer="Rexel",
7474
configuration_url="https://utilisateur.energeasyconnect.com/user/#/zone/equipements",
7575
session=session,
7676
),
77-
"simu_livein2": lambda session: DefaultServer( # alias of https://tahomalink.com
77+
"simu_livein2": lambda session: DefaultClient( # alias of https://tahomalink.com
7878
name="SIMU (LiveIn2)",
7979
endpoint="https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI/",
8080
manufacturer="Somfy",
8181
configuration_url=None,
8282
session=session,
8383
),
84-
"somfy_europe": lambda session: SomfyServer( # alias of https://tahomalink.com
84+
"somfy_europe": lambda session: SomfyClient( # alias of https://tahomalink.com
8585
name="Somfy (Europe)",
8686
endpoint="https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI/",
8787
manufacturer="Somfy",
8888
configuration_url="https://www.tahomalink.com",
8989
session=session,
9090
),
91-
"somfy_america": lambda session: DefaultServer(
91+
"somfy_america": lambda session: DefaultClient(
9292
name="Somfy (North America)",
9393
endpoint="https://ha401-1.overkiz.com/enduser-mobile-web/enduserAPI/",
9494
manufacturer="Somfy",
9595
configuration_url=None,
9696
session=session,
9797
),
98-
"somfy_oceania": lambda session: DefaultServer(
98+
"somfy_oceania": lambda session: DefaultClient(
9999
name="Somfy (Oceania)",
100100
endpoint="https://ha201-1.overkiz.com/enduser-mobile-web/enduserAPI/",
101101
manufacturer="Somfy",
102102
configuration_url=None,
103103
session=session,
104104
),
105-
"ubiwizz": lambda session: DefaultServer(
105+
"ubiwizz": lambda session: DefaultClient(
106106
name="Ubiwizz",
107107
endpoint="https://ha129-1.overkiz.com/enduser-mobile-web/enduserAPI/",
108108
manufacturer="Decelect",

0 commit comments

Comments
 (0)