-
Notifications
You must be signed in to change notification settings - Fork 26
/
client_abstract.py
48 lines (39 loc) · 1.3 KB
/
client_abstract.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from requests.packages import urllib3
from logging import Logger
from tplinkrouterc6u.common.package_enum import Connection
from tplinkrouterc6u.common.dataclass import Firmware, Status
from abc import ABC, abstractmethod
class AbstractRouter(ABC):
def __init__(self, host: str, password: str, username: str = 'admin', logger: Logger = None,
verify_ssl: bool = True, timeout: int = 30) -> None:
self.username = username
self.password = password
self.timeout = timeout
self._logger = logger
self.host = host
if not (self.host.startswith('http://') or self.host.startswith('https://')):
self.host = "http://{}".format(self.host)
self._verify_ssl = verify_ssl
if self._verify_ssl is False:
urllib3.disable_warnings()
@abstractmethod
def supports(self) -> bool:
pass
@abstractmethod
def authorize(self) -> None:
pass
@abstractmethod
def logout(self) -> None:
pass
@abstractmethod
def get_firmware(self) -> Firmware:
pass
@abstractmethod
def get_status(self) -> Status:
pass
@abstractmethod
def reboot(self) -> None:
pass
@abstractmethod
def set_wifi(self, wifi: Connection, enable: bool) -> None:
pass