Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit f8d20f0

Browse files
authored
fix: SeamAPIException should be named SeamApiException (#134)
1 parent faedefa commit f8d20f0

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

seamapi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# type: ignore
33

44
from seamapi.seam import Seam
5-
from seamapi.seam import SeamAPIException
5+
from seamapi.seam import SeamApiException

seamapi/seam.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import sentry_sdk
77
import pkg_resources
88
from typing import Optional, cast
9-
from .types import AbstractSeam, SeamAPIException
9+
from .types import AbstractSeam, SeamApiException
1010

1111

1212
class Seam(AbstractSeam):
@@ -126,7 +126,7 @@ def make_request(self, method: str, path: str, **kwargs):
126126

127127

128128
if response.status_code != 200:
129-
raise SeamAPIException(response)
129+
raise SeamApiException(response)
130130

131131
if "application/json" in response.headers["content-type"]:
132132
return response.json()

seamapi/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
ClimateSettingScheduleId = str
2020

2121

22-
class SeamAPIException(Exception):
22+
class SeamApiException(Exception):
2323
def __init__(
2424
self,
2525
response,
@@ -33,7 +33,7 @@ def __init__(
3333
self.metadata = parsed_response.get("error", None)
3434

3535
super().__init__(
36-
f"SeamAPIException: status={self.status_code}, request_id={self.request_id}, metadata={self.metadata}"
36+
f"SeamApiException: status={self.status_code}, request_id={self.request_id}, metadata={self.metadata}"
3737
)
3838

3939

seamapi/utils/report_error.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from seamapi.types import SeamAPIException
1+
from seamapi.types import SeamApiException
22

33
"""
44
A decorator for model methods that will report errors to Sentry (if enabled).
@@ -9,7 +9,7 @@ def wrapper(self, *args, **kwargs):
99
try:
1010
return f(self, *args, **kwargs)
1111
except Exception as error:
12-
if self.seam.should_report_exceptions and type(error) is not SeamAPIException:
12+
if self.seam.should_report_exceptions and type(error) is not SeamApiException:
1313
self.seam.sentry_client.capture_exception(error)
1414

1515
raise error

tests/access_codes/test_access_codes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from seamapi import Seam
2-
from seamapi.types import SeamAPIException
2+
from seamapi.types import SeamApiException
33
from tests.fixtures.run_august_factory import run_august_factory
44
import pytest
55

@@ -28,7 +28,7 @@ def test_access_codes(seam: Seam):
2828
access_code = seam.access_codes.get(created_access_code.access_code_id)
2929
assert access_code.code == "4444"
3030

31-
with pytest.raises(SeamAPIException):
31+
with pytest.raises(SeamApiException):
3232
seam.access_codes.create(
3333
some_device.device_id, "Duplicate Access Code", "4444"
3434
)

tests/devices/test_devices.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from seamapi import Seam
2-
from seamapi.types import SeamAPIException
2+
from seamapi.types import SeamApiException
33
from tests.fixtures.run_august_factory import run_august_factory
44
from seamapi.utils.deep_attr_dict import DeepAttrDict
55

@@ -59,7 +59,7 @@ def test_devices(seam: Seam):
5959
try:
6060
seam.devices.get(name="foo")
6161
assert False
62-
except SeamAPIException as error:
62+
except SeamApiException as error:
6363
assert error.status_code == 404
6464
assert type(error.request_id) == str
6565
assert error.metadata["type"] == "device_not_found"

tests/noise_sensors/noise_thresholds/test_noise_thresholds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import time
22
from seamapi import Seam
3-
from seamapi.types import SeamAPIException
3+
from seamapi.types import SeamApiException
44
from tests.fixtures.run_minut_factory import run_minut_factory
55

66

0 commit comments

Comments
 (0)