diff --git a/pybotvac/robot.py b/pybotvac/robot.py index 432456a..8954d36 100644 --- a/pybotvac/robot.py +++ b/pybotvac/robot.py @@ -174,13 +174,13 @@ def _message(self, json: dict, schema: Schema): """ try: - # pylint: disable=missing-timeout response = requests.post( self._url, json=json, verify=self._vendor.cert_path, auth=Auth(self.serial, self.secret), headers=self._headers, + timeout=10, ) response.raise_for_status() schema(response.json()) diff --git a/pybotvac/session.py b/pybotvac/session.py index 60fac5f..97fbdc1 100644 --- a/pybotvac/session.py +++ b/pybotvac/session.py @@ -59,7 +59,6 @@ def _login(self, email: str, password: str): """ try: - # pylint: disable=missing-timeout response = requests.post( urljoin(self.endpoint, "sessions"), json={ @@ -69,6 +68,7 @@ def _login(self, email: str, password: str): "token": binascii.hexlify(os.urandom(64)).decode("utf8"), }, headers=self.headers, + timeout=10, ) response.raise_for_status() @@ -94,8 +94,7 @@ def get(self, path, **kwargs): url = self.urljoin(path) headers = self.generate_headers(kwargs.pop("headers", None)) try: - # pylint: disable=missing-timeout - response = requests.get(url, headers=headers, **kwargs) + response = requests.get(url, headers=headers, timeout=10, **kwargs) response.raise_for_status() except ( requests.exceptions.ConnectionError, @@ -208,7 +207,6 @@ def __init__( def send_email_otp(self, email: str): """Request an authorization code via email.""" - # pylint: disable=missing-timeout response = requests.post( self.vendor.passwordless_endpoint, data=json.dumps( @@ -220,12 +218,12 @@ def send_email_otp(self, email: str): } ), headers={"Content-Type": "application/json"}, + timeout=10, ) response.raise_for_status() def fetch_token_passwordless(self, email: str, code: str): """Fetch an access token using the emailed code.""" - # pylint: disable=missing-timeout response = requests.post( self.vendor.token_endpoint, data=json.dumps( @@ -245,6 +243,7 @@ def fetch_token_passwordless(self, email: str, code: str): } ), headers={"Content-Type": "application/json"}, + timeout=10, ) response.raise_for_status() self._token = response.json() @@ -257,8 +256,7 @@ def get(self, path: str, **kwargs) -> requests.Response: headers["Authorization"] = "Auth0Bearer {}".format(self._token.get("id_token")) try: - # pylint: disable=missing-timeout - response = requests.get(url, headers=headers) + response = requests.get(url, headers=headers, timeout=10) response.raise_for_status() except ( requests.exceptions.ConnectionError, diff --git a/setup.cfg b/setup.cfg index 211a3a7..457e051 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,7 +5,8 @@ skip = ./.git,./.mypy_cache,./.vscode,./venv exclude = .vscode,venv max-line-length = 88 ignore = - F401, # Import error, pylint covers this + # Import error, pylint covers this + F401, # Formatting errors that are covered by black D202, E203,