Skip to content

Commit a3ee82b

Browse files
committed
Refactor README examples to use Server enum and generate_local_server utility
1 parent 1e81413 commit a3ee82b

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

README.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ PASSWORD = ""
4949

5050
async def main() -> None:
5151
async with OverkizClient(
52-
server=SUPPORTED_SERVERS[Server.SOMFY_EUROPE],
52+
server=Server.SOMFY_EUROPE,
5353
credentials=UsernamePasswordCredentials(USERNAME, PASSWORD),
5454
) as client:
5555
try:
@@ -95,10 +95,8 @@ import time
9595

9696
from pyoverkiz.auth.credentials import LocalTokenCredentials
9797
from pyoverkiz.client import OverkizClient
98-
from pyoverkiz.const import OverkizServer
98+
from pyoverkiz.utils import generate_local_server
9999

100-
USERNAME = ""
101-
PASSWORD = ""
102100
LOCAL_GATEWAY = "gateway-xxxx-xxxx-xxxx.local" # or use the IP address of your gateway
103101
VERIFY_SSL = True # set verify_ssl to False if you don't use the .local hostname
104102

@@ -107,12 +105,7 @@ async def main() -> None:
107105
token = "" # generate your token via the Somfy app and include it here
108106

109107
async with OverkizClient(
110-
server=OverkizServer(
111-
name="Somfy TaHoma (local)",
112-
endpoint=f"https://{LOCAL_GATEWAY}:8443/enduser-mobile-web/1/enduserAPI/",
113-
manufacturer="Somfy",
114-
configuration_url=None,
115-
),
108+
server=generate_local_server(host=LOCAL_GATEWAY),
116109
credentials=LocalTokenCredentials(token),
117110
verify_ssl=VERIFY_SSL,
118111
) as client:

0 commit comments

Comments
 (0)