Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add local support for Somfy Developer Mode #441

Merged
merged 13 commits into from
Apr 11, 2022
Prev Previous commit
Next Next commit
Remove SSL check for now
  • Loading branch information
iMicknl authored Apr 11, 2022
commit 3e2fad21628d9b4141074e1894409a2a7301df49
19 changes: 2 additions & 17 deletions pyoverkiz/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

import asyncio
import datetime
import os
import ssl
import urllib.parse
from json import JSONDecodeError
from types import TracebackType
Expand Down Expand Up @@ -50,8 +48,8 @@
TooManyConcurrentRequestsException,
TooManyExecutionsException,
TooManyRequestsException,
UnknownUserException,
UnknownObjectException,
UnknownUserException,
)
from pyoverkiz.models import (
Command,
Expand Down Expand Up @@ -98,7 +96,6 @@ class OverkizClient:
_expires_in: datetime.datetime | None = None
_access_token: str | None = None
_is_local: bool = False
_ssl_context: ssl.SSLContext | None = None

def __init__(
self,
Expand Down Expand Up @@ -132,14 +129,6 @@ def __init__(
self._is_local = True
self._access_token = token

# To avoid security issue, add the following authority to
# your HTTPS client trust store: https://ca.overkiz.com/overkiz-root-ca-2048.crt
self._ssl_context = ssl.create_default_context(
cafile=os.path.dirname(os.path.realpath(__file__))
+ "/overkiz-root-ca-2048.crt"
)
self._ssl_context = None

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

Expand Down Expand Up @@ -757,7 +746,6 @@ async def __get(self, path: str) -> Any:
async with self.session.get(
f"{self.server.endpoint}{path}",
headers=headers,
ssl_context=self._ssl_context,
) as response:
await self.check_response(response)
return await response.json()
Expand Down Expand Up @@ -863,15 +851,12 @@ async def check_response(response: ClientResponse) -> None:
if "Not such token with UUID: " in message:
raise NotSuchTokenException(message)


<< << << < HEAD
if "Unknown user :" in message:
raise UnknownUserException(message)
== == == =

# {"error":"Unknown object.","errorCode":"UNSPECIFIED_ERROR"}
if message == "Unknown object.":
raise UnknownObjectException(message)
>>>>>> > 562d327(Add Unknown Object exception)

raise Exception(message if message else result)

Expand Down
20 changes: 0 additions & 20 deletions pyoverkiz/overkiz-root-ca-2048.crt

This file was deleted.