Skip to content

Commit ffe29ab

Browse files
fix: Rename SeamApiException to SeamHttpApiError (#58)
1 parent 1e2c2bd commit ffe29ab

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

seam/__init__.py

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

44
from seam.seam import Seam
5-
from seam.types import SeamApiException
5+
from seam.types import SeamHttpApiError
66
from seam.seam_multi_workspace import SeamMultiWorkspace
77
from seam.options import SeamHttpInvalidOptionsError
88
from seam.auth import SeamHttpInvalidTokenError

seam/request.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import requests
22
from importlib.metadata import version
33

4-
from seam.types import AbstractRequestMixin, SeamApiException
4+
from seam.types import AbstractRequestMixin, SeamHttpApiError
55

66

77
class RequestMixin(AbstractRequestMixin):
@@ -20,7 +20,7 @@ def make_request(self, method: str, path: str, **kwargs):
2020
2121
Raises
2222
------
23-
SeamApiException: If the response status code is not successful.
23+
SeamHttpApiError: If the response status code is not successful.
2424
"""
2525

2626
url = self._endpoint + path
@@ -39,7 +39,7 @@ def make_request(self, method: str, path: str, **kwargs):
3939
response = requests.request(method, url, headers=headers, **kwargs)
4040

4141
if response.status_code != 200:
42-
raise SeamApiException(response)
42+
raise SeamHttpApiError(response)
4343

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

seam/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from seam.routes.types import AbstractRoutes, Workspace
66

77

8-
class SeamApiException(Exception):
8+
class SeamHttpApiError(Exception):
99
def __init__(
1010
self,
1111
response,
@@ -19,7 +19,7 @@ def __init__(
1919
self.metadata = parsed_response.get("error", None)
2020

2121
super().__init__(
22-
f"SeamApiException: status={self.status_code}, request_id={self.request_id}, metadata={self.metadata}"
22+
f"SeamHttpApiError: status={self.status_code}, request_id={self.request_id}, metadata={self.metadata}"
2323
)
2424

2525

test/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 seam import Seam
2-
from seam.types import SeamApiException
2+
from seam.types import SeamHttpApiError
33
import pytest
44

55

@@ -31,7 +31,7 @@ def test_access_codes(seam: Seam):
3131
)
3232
assert access_code.code == "4444"
3333

34-
with pytest.raises(SeamApiException):
34+
with pytest.raises(SeamHttpApiError):
3535
seam.access_codes.create(
3636
device_id=some_device.device_id, name="Duplicate Access Code", code="4444"
3737
)

test/connected_accounts/test_connected_accounts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from seam import Seam
2-
from seam.types import SeamApiException
2+
from seam.types import SeamHttpApiError
33

44
EMAIL = "john@example.com"
55

@@ -27,5 +27,5 @@ def test_connected_accounts(seam: Seam):
2727
# connected_account and email parameters are not provided.
2828
try:
2929
seam.connected_accounts.get()
30-
except SeamApiException as e:
30+
except SeamHttpApiError as e:
3131
assert e.metadata["message"] == "Invalid input"

test/devices/test_devices.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from seam import Seam
2-
from seam.types import SeamApiException
2+
from seam.types import SeamHttpApiError
33

44

55
def test_devices(seam: Seam):
@@ -61,7 +61,7 @@ def test_devices(seam: Seam):
6161
try:
6262
seam.devices.get(name="foo")
6363
assert False
64-
except SeamApiException as error:
64+
except SeamHttpApiError as error:
6565
assert error.status_code == 404
6666
assert type(error.request_id) == str
6767
assert error.metadata["type"] == "device_not_found"

test/events/test_events.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import time
22
from seam import Seam
33

4-
from seam.types import SeamApiException
4+
from seam.types import SeamHttpApiError
55

66
SINCE = "2021-01-01T00:00:00.000Z"
77
EVENT_TYPE = "device.connected"
@@ -24,5 +24,5 @@ def test_events(seam: Seam):
2424

2525
try:
2626
seam.events.get(event_id=FAKE_UUID)
27-
except SeamApiException as e:
27+
except SeamHttpApiError as e:
2828
assert e.metadata["message"] == "Event not found"

test/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 seam import Seam
3-
from seam.types import SeamApiException
3+
from seam.types import SeamHttpApiError
44
import pytest
55

66

0 commit comments

Comments
 (0)