@seamapi/nextlove-sdk-generator 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/generate-python-sdk/generate-python-sdk.js +0 -6
- package/lib/generate-python-sdk/generate-python-sdk.js.map +1 -1
- package/lib/generate-python-sdk/templates/.gitignore.template.js +0 -1
- package/lib/generate-python-sdk/templates/.gitignore.template.js.map +1 -1
- package/lib/generate-python-sdk/templates/conftest.py.template.js +0 -57
- package/lib/generate-python-sdk/templates/conftest.py.template.js.map +1 -1
- package/lib/generate-python-sdk/templates/pyproject.toml.template.js +0 -1
- package/lib/generate-python-sdk/templates/pyproject.toml.template.js.map +1 -1
- package/lib/generate-python-sdk/templates/seam.py.template.js +0 -58
- package/lib/generate-python-sdk/templates/seam.py.template.js.map +1 -1
- package/lib/generate-python-sdk/templates/snippets/abstract-seam.template.js +0 -1
- package/lib/generate-python-sdk/templates/snippets/abstract-seam.template.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/generate-python-sdk/generate-python-sdk.ts +0 -7
- package/src/lib/generate-python-sdk/templates/.gitignore.template.ts +0 -1
- package/src/lib/generate-python-sdk/templates/conftest.py.template.ts +0 -57
- package/src/lib/generate-python-sdk/templates/pyproject.toml.template.ts +0 -1
- package/src/lib/generate-python-sdk/templates/seam.py.template.ts +0 -58
- package/src/lib/generate-python-sdk/templates/snippets/abstract-seam.template.ts +0 -1
- package/lib/generate-python-sdk/templates/prebuild.py.template.d.ts +0 -2
- package/lib/generate-python-sdk/templates/prebuild.py.template.js +0 -13
- package/lib/generate-python-sdk/templates/prebuild.py.template.js.map +0 -1
- package/lib/generate-python-sdk/templates/utils/get_sentry_dsn.py.template.d.ts +0 -2
- package/lib/generate-python-sdk/templates/utils/get_sentry_dsn.py.template.js +0 -6
- package/lib/generate-python-sdk/templates/utils/get_sentry_dsn.py.template.js.map +0 -1
- package/lib/generate-python-sdk/templates/utils/report_error.py.template.d.ts +0 -2
- package/lib/generate-python-sdk/templates/utils/report_error.py.template.js +0 -17
- package/lib/generate-python-sdk/templates/utils/report_error.py.template.js.map +0 -1
- package/src/lib/generate-python-sdk/templates/prebuild.py.template.ts +0 -12
- package/src/lib/generate-python-sdk/templates/utils/get_sentry_dsn.py.template.ts +0 -5
- package/src/lib/generate-python-sdk/templates/utils/report_error.py.template.ts +0 -16
|
@@ -15,9 +15,6 @@ import resourceDataclassTemplate from "./templates/snippets/resource-dataclass.t
|
|
|
15
15
|
import readmeMdTemplate from "./templates/readme.md.template.js";
|
|
16
16
|
import initTemplate from "./templates/__init__.py.template.js";
|
|
17
17
|
import gitignoreTemplate from "./templates/.gitignore.template.js";
|
|
18
|
-
import prebuildTemplate from "./templates/prebuild.py.template.js";
|
|
19
|
-
import reportErrorTemplate from "./templates/utils/report_error.py.template.js";
|
|
20
|
-
import getSentryDsnTemplate from "./templates/utils/get_sentry_dsn.py.template.js";
|
|
21
18
|
import SeamApiExceptionClassTemplate from "./templates/snippets/seam-api-exception-class.template.js";
|
|
22
19
|
import { getParameterAndResponseSchema } from "../../lib/openapi/get-parameter-and-response-schema.js";
|
|
23
20
|
import mapParentToChildResources from "../../lib/openapi/map-parent-to-children-resource.js";
|
|
@@ -137,13 +134,10 @@ export const generatePythonSDK = async () => {
|
|
|
137
134
|
fs["README.md"] = readmeMdTemplate();
|
|
138
135
|
fs["pyproject.toml"] = pyprojectTomlTemplate();
|
|
139
136
|
fs[".gitignore"] = gitignoreTemplate();
|
|
140
|
-
fs["scripts/prebuild.py"] = prebuildTemplate();
|
|
141
137
|
fs["seamapi/__init__.py"] = initTemplate();
|
|
142
138
|
fs["seamapi/routes.py"] = routesPyTemplate(top_level_namespaces);
|
|
143
139
|
fs["seamapi/seam.py"] = seamPyTemplate();
|
|
144
140
|
fs["seamapi/utils/deep_attr_dict.py"] = deep_attr_dictPyTemplate();
|
|
145
|
-
fs["seamapi/utils/report_error.py"] = reportErrorTemplate();
|
|
146
|
-
fs["seamapi/utils/get_sentry_dsn.py"] = getSentryDsnTemplate();
|
|
147
141
|
fs["tests/conftest.py"] = conftestPyTemplate();
|
|
148
142
|
fs["tests/test_smoke.py"] = test_smokePyTemplate();
|
|
149
143
|
fs["tests/__init__.py"] = "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-python-sdk.js","sourceRoot":"","sources":["../../src/lib/generate-python-sdk/generate-python-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,kBAAkB,MAAM,qCAAqC,CAAA;AACpE,OAAO,gBAAgB,MAAM,mCAAmC,CAAA;AAChE,OAAO,cAAc,MAAM,iCAAiC,CAAA;AAC5D,OAAO,oBAAoB,MAAM,uCAAuC,CAAA;AACxE,OAAO,qBAAqB,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,wBAAwB,MAAM,iDAAiD,CAAA;AACtF,OAAO,sBAAsB,MAAM,kDAAkD,CAAA;AACrF,OAAO,oBAAoB,MAAM,gDAAgD,CAAA;AACjF,OAAO,yBAAyB,MAAM,qDAAqD,CAAA;AAC3F,OAAO,gBAAgB,MAAM,mCAAmC,CAAA;AAChE,OAAO,YAAY,MAAM,qCAAqC,CAAA;AAC9D,OAAO,iBAAiB,MAAM,oCAAoC,CAAA;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"generate-python-sdk.js","sourceRoot":"","sources":["../../src/lib/generate-python-sdk/generate-python-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,UA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GAAG,cAAc,EAAE,CAAA;IACxC,EAAE,CAAC,iCAAiC,CAAC,GAAG,wBAAwB,EAAE,CAAA;IAElE,EAAE,CAAC,mBAAmB,CAAC,GAAG,kBAAkB,EAAE,CAAA;IAC9C,EAAE,CAAC,qBAAqB,CAAC,GAAG,oBAAoB,EAAE,CAAA;IAClD,EAAE,CAAC,mBAAmB,CAAC,GAAG,EAAE,CAAA;IAE5B,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAED,SAAS,uBAAuB,CAAC,EAC/B,UAAU,EACV,iBAAiB,EACjB,iBAAiB,GAKlB;IACC,IAAI,6CAA6C,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;QACtE,OAAO,MAAM,CAAA;KACd;IAED,IAAI,iBAAiB,EAAE;QACrB,OAAO,UAAU,CAAC,iBAAiB,CAAC,CAAA;KACrC;IAED,IAAI,iBAAiB,EAAE;QACrB,OAAO,QAAQ,UAAU,CAAC,iBAAiB,CAAC,GAAG,CAAA;KAChD;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":".gitignore.template.js","sourceRoot":"","sources":["../../../src/lib/generate-python-sdk/templates/.gitignore.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC
|
|
1
|
+
{"version":3,"file":".gitignore.template.js","sourceRoot":"","sources":["../../../src/lib/generate-python-sdk/templates/.gitignore.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;CASpB,CAAA"}
|
|
@@ -11,13 +11,6 @@ from dataclasses import dataclass
|
|
|
11
11
|
def dotenv_fixture():
|
|
12
12
|
load_dotenv()
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
@dataclass
|
|
16
|
-
class SeamBackend:
|
|
17
|
-
url: str
|
|
18
|
-
sandbox_api_key: str
|
|
19
|
-
|
|
20
|
-
|
|
21
14
|
# TODO this should use scope="session", but there's some issue, this would
|
|
22
15
|
# dramatically reduce test time to switch
|
|
23
16
|
@pytest.fixture(scope="function")
|
|
@@ -27,55 +20,5 @@ def seam_backend():
|
|
|
27
20
|
url=f"https://{random_string}.fakeseamconnect.seam.vc",
|
|
28
21
|
sandbox_api_key="seam_apikey1_token",
|
|
29
22
|
)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@pytest.fixture
|
|
33
|
-
def seam(seam_backend: Any):
|
|
34
|
-
seam = Seam(api_url=seam_backend.url, api_key=seam_backend.sandbox_api_key)
|
|
35
|
-
# seam.make_request("POST", "/workspaces/reset_sandbox")
|
|
36
|
-
yield seam
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
@pytest.fixture
|
|
40
|
-
def fake_sentry(monkeypatch):
|
|
41
|
-
sentry_dsn = "https://key@sentry.io/123"
|
|
42
|
-
|
|
43
|
-
monkeypatch.setenv("SENTRY_DSN", sentry_dsn)
|
|
44
|
-
|
|
45
|
-
sentry_init_args = {}
|
|
46
|
-
sentry_capture_exception_calls = []
|
|
47
|
-
sentry_add_breadcrumb_calls = []
|
|
48
|
-
|
|
49
|
-
class TestSentryClient(object):
|
|
50
|
-
def __init__(self, *args, **kwargs):
|
|
51
|
-
sentry_init_args.update(kwargs)
|
|
52
|
-
|
|
53
|
-
def set_context(self, *args, **kwargs):
|
|
54
|
-
pass
|
|
55
|
-
|
|
56
|
-
monkeypatch.setattr("sentry_sdk.Client", TestSentryClient)
|
|
57
|
-
|
|
58
|
-
class TestSentryScope(object):
|
|
59
|
-
def set_context(self, *args, **kwargs):
|
|
60
|
-
pass
|
|
61
|
-
|
|
62
|
-
class TestSentryHub(object):
|
|
63
|
-
def __init__(self, *args, **kwargs):
|
|
64
|
-
self.scope = TestSentryScope()
|
|
65
|
-
|
|
66
|
-
def capture_exception(self, *args, **kwargs):
|
|
67
|
-
sentry_capture_exception_calls.append((args, kwargs))
|
|
68
|
-
|
|
69
|
-
def add_breadcrumb(self, *args, **kwargs):
|
|
70
|
-
sentry_add_breadcrumb_calls.append((args, kwargs))
|
|
71
|
-
|
|
72
|
-
monkeypatch.setattr("sentry_sdk.Hub", TestSentryHub)
|
|
73
|
-
|
|
74
|
-
yield {
|
|
75
|
-
"sentry_init_args": sentry_init_args,
|
|
76
|
-
"sentry_capture_exception_calls": sentry_capture_exception_calls,
|
|
77
|
-
"sentry_add_breadcrumb_calls": sentry_add_breadcrumb_calls,
|
|
78
|
-
"sentry_dsn": sentry_dsn,
|
|
79
|
-
}
|
|
80
23
|
`;
|
|
81
24
|
//# sourceMappingURL=conftest.py.template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conftest.py.template.js","sourceRoot":"","sources":["../../../src/lib/generate-python-sdk/templates/conftest.py.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC
|
|
1
|
+
{"version":3,"file":"conftest.py.template.js","sourceRoot":"","sources":["../../../src/lib/generate-python-sdk/templates/conftest.py.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;CAsBpB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pyproject.toml.template.js","sourceRoot":"","sources":["../../../src/lib/generate-python-sdk/templates/pyproject.toml.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC
|
|
1
|
+
{"version":3,"file":"pyproject.toml.template.js","sourceRoot":"","sources":["../../../src/lib/generate-python-sdk/templates/pyproject.toml.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;CAsBpB,CAAA"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export default () => `import os
|
|
2
2
|
|
|
3
|
-
from seamapi.utils.get_sentry_dsn import get_sentry_dsn
|
|
4
3
|
from .routes import Routes
|
|
5
4
|
import requests
|
|
6
|
-
import sentry_sdk
|
|
7
5
|
import pkg_resources
|
|
8
6
|
from typing import Optional, cast
|
|
9
7
|
from .types import AbstractSeam, SeamApiException
|
|
@@ -12,33 +10,6 @@ from .types import AbstractSeam, SeamApiException
|
|
|
12
10
|
class Seam(AbstractSeam):
|
|
13
11
|
"""
|
|
14
12
|
Initial Seam class used to interact with Seam API
|
|
15
|
-
|
|
16
|
-
...
|
|
17
|
-
|
|
18
|
-
Attributes
|
|
19
|
-
----------
|
|
20
|
-
api_key : str
|
|
21
|
-
API key (default None)
|
|
22
|
-
api_url : str
|
|
23
|
-
API url (default "https://connect.getseam.com")
|
|
24
|
-
lts_version : str
|
|
25
|
-
LTS version
|
|
26
|
-
workspaces : Workspaces
|
|
27
|
-
Workspaces class
|
|
28
|
-
connected_accounts : ConnectedAccounts
|
|
29
|
-
Connected accounts class
|
|
30
|
-
connect_webviews : ConnectWebviews
|
|
31
|
-
Connect webviews class
|
|
32
|
-
devices : Devices
|
|
33
|
-
Devices class
|
|
34
|
-
events : Events
|
|
35
|
-
Events class
|
|
36
|
-
locks : Locks
|
|
37
|
-
Locks class
|
|
38
|
-
access_codes : AccessCodes
|
|
39
|
-
Access codes class
|
|
40
|
-
action_attempts : ActionAttempts
|
|
41
|
-
Action attempts class
|
|
42
13
|
"""
|
|
43
14
|
|
|
44
15
|
api_key: str
|
|
@@ -51,7 +22,6 @@ class Seam(AbstractSeam):
|
|
|
51
22
|
*,
|
|
52
23
|
workspace_id: Optional[str] = None,
|
|
53
24
|
api_url: Optional[str] = None,
|
|
54
|
-
should_report_exceptions: Optional[bool] = False,
|
|
55
25
|
):
|
|
56
26
|
"""
|
|
57
27
|
Parameters
|
|
@@ -62,8 +32,6 @@ class Seam(AbstractSeam):
|
|
|
62
32
|
Workspace id
|
|
63
33
|
api_url : str, optional
|
|
64
34
|
API url
|
|
65
|
-
should_report_exceptions : bool, optional
|
|
66
|
-
Defaults to False. If true, thrown exceptions will be reported to Seam.
|
|
67
35
|
"""
|
|
68
36
|
Routes.__init__(self)
|
|
69
37
|
|
|
@@ -91,18 +59,6 @@ class Seam(AbstractSeam):
|
|
|
91
59
|
if api_url is not None:
|
|
92
60
|
self.api_url = cast(str, api_url)
|
|
93
61
|
|
|
94
|
-
self.should_report_exceptions = should_report_exceptions
|
|
95
|
-
|
|
96
|
-
if self.should_report_exceptions:
|
|
97
|
-
self.sentry_client = sentry_sdk.Hub(sentry_sdk.Client(
|
|
98
|
-
dsn=get_sentry_dsn(),
|
|
99
|
-
))
|
|
100
|
-
self.sentry_client.scope.set_context("sdk_info", {
|
|
101
|
-
"repository": "https://github.com/seamapi/python",
|
|
102
|
-
"version": pkg_resources.get_distribution("seamapi").version,
|
|
103
|
-
"endpoint": self.api_url,
|
|
104
|
-
})
|
|
105
|
-
|
|
106
62
|
def make_request(self, method: str, path: str, **kwargs):
|
|
107
63
|
"""
|
|
108
64
|
Makes a request to the API
|
|
@@ -131,20 +87,6 @@ class Seam(AbstractSeam):
|
|
|
131
87
|
headers["seam-workspace"] = self.workspace_id
|
|
132
88
|
response = requests.request(method, url, headers=headers, **kwargs)
|
|
133
89
|
|
|
134
|
-
if self.should_report_exceptions and response.status_code:
|
|
135
|
-
# Add breadcrumb
|
|
136
|
-
self.sentry_client.add_breadcrumb(
|
|
137
|
-
category="http",
|
|
138
|
-
level="info",
|
|
139
|
-
data={
|
|
140
|
-
"method": method,
|
|
141
|
-
"url": url,
|
|
142
|
-
"status_code": response.status_code,
|
|
143
|
-
"request_id": response.headers.get("seam-request-id", "unknown"),
|
|
144
|
-
},
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
|
|
148
90
|
if response.status_code != 200:
|
|
149
91
|
raise SeamApiException(response)
|
|
150
92
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seam.py.template.js","sourceRoot":"","sources":["../../../src/lib/generate-python-sdk/templates/seam.py.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC
|
|
1
|
+
{"version":3,"file":"seam.py.template.js","sourceRoot":"","sources":["../../../src/lib/generate-python-sdk/templates/seam.py.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgGpB,CAAA"}
|
|
@@ -11,7 +11,6 @@ class AbstractSeam(AbstractRoutes):
|
|
|
11
11
|
api_key: Optional[str] = None,
|
|
12
12
|
workspace_id: Optional[str] = None,
|
|
13
13
|
api_url: Optional[str] = None,
|
|
14
|
-
should_report_exceptions: Optional[bool] = False,
|
|
15
14
|
):
|
|
16
15
|
raise NotImplementedError`;
|
|
17
16
|
//# sourceMappingURL=abstract-seam.template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-seam.template.js","sourceRoot":"","sources":["../../../../src/lib/generate-python-sdk/templates/snippets/abstract-seam.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC
|
|
1
|
+
{"version":3,"file":"abstract-seam.template.js","sourceRoot":"","sources":["../../../../src/lib/generate-python-sdk/templates/snippets/abstract-seam.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;kCAca,CAAA"}
|
package/package.json
CHANGED
|
@@ -16,9 +16,6 @@ import resourceDataclassTemplate from "./templates/snippets/resource-dataclass.t
|
|
|
16
16
|
import readmeMdTemplate from "./templates/readme.md.template.js"
|
|
17
17
|
import initTemplate from "./templates/__init__.py.template.js"
|
|
18
18
|
import gitignoreTemplate from "./templates/.gitignore.template.js"
|
|
19
|
-
import prebuildTemplate from "./templates/prebuild.py.template.js"
|
|
20
|
-
import reportErrorTemplate from "./templates/utils/report_error.py.template.js"
|
|
21
|
-
import getSentryDsnTemplate from "./templates/utils/get_sentry_dsn.py.template.js"
|
|
22
19
|
import SeamApiExceptionClassTemplate from "./templates/snippets/seam-api-exception-class.template.js"
|
|
23
20
|
import { getParameterAndResponseSchema } from "lib/openapi/get-parameter-and-response-schema.js"
|
|
24
21
|
import mapParentToChildResources from "lib/openapi/map-parent-to-children-resource.js"
|
|
@@ -177,16 +174,12 @@ export const generatePythonSDK = async () => {
|
|
|
177
174
|
fs["README.md"] = readmeMdTemplate()
|
|
178
175
|
fs["pyproject.toml"] = pyprojectTomlTemplate()
|
|
179
176
|
fs[".gitignore"] = gitignoreTemplate()
|
|
180
|
-
fs["scripts/prebuild.py"] = prebuildTemplate()
|
|
181
177
|
|
|
182
178
|
fs["seamapi/__init__.py"] = initTemplate()
|
|
183
179
|
fs["seamapi/routes.py"] = routesPyTemplate(top_level_namespaces)
|
|
184
180
|
fs["seamapi/seam.py"] = seamPyTemplate()
|
|
185
181
|
fs["seamapi/utils/deep_attr_dict.py"] = deep_attr_dictPyTemplate()
|
|
186
182
|
|
|
187
|
-
fs["seamapi/utils/report_error.py"] = reportErrorTemplate()
|
|
188
|
-
fs["seamapi/utils/get_sentry_dsn.py"] = getSentryDsnTemplate()
|
|
189
|
-
|
|
190
183
|
fs["tests/conftest.py"] = conftestPyTemplate()
|
|
191
184
|
fs["tests/test_smoke.py"] = test_smokePyTemplate()
|
|
192
185
|
fs["tests/__init__.py"] = ""
|
|
@@ -11,13 +11,6 @@ from dataclasses import dataclass
|
|
|
11
11
|
def dotenv_fixture():
|
|
12
12
|
load_dotenv()
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
@dataclass
|
|
16
|
-
class SeamBackend:
|
|
17
|
-
url: str
|
|
18
|
-
sandbox_api_key: str
|
|
19
|
-
|
|
20
|
-
|
|
21
14
|
# TODO this should use scope="session", but there's some issue, this would
|
|
22
15
|
# dramatically reduce test time to switch
|
|
23
16
|
@pytest.fixture(scope="function")
|
|
@@ -27,54 +20,4 @@ def seam_backend():
|
|
|
27
20
|
url=f"https://{random_string}.fakeseamconnect.seam.vc",
|
|
28
21
|
sandbox_api_key="seam_apikey1_token",
|
|
29
22
|
)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@pytest.fixture
|
|
33
|
-
def seam(seam_backend: Any):
|
|
34
|
-
seam = Seam(api_url=seam_backend.url, api_key=seam_backend.sandbox_api_key)
|
|
35
|
-
# seam.make_request("POST", "/workspaces/reset_sandbox")
|
|
36
|
-
yield seam
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
@pytest.fixture
|
|
40
|
-
def fake_sentry(monkeypatch):
|
|
41
|
-
sentry_dsn = "https://key@sentry.io/123"
|
|
42
|
-
|
|
43
|
-
monkeypatch.setenv("SENTRY_DSN", sentry_dsn)
|
|
44
|
-
|
|
45
|
-
sentry_init_args = {}
|
|
46
|
-
sentry_capture_exception_calls = []
|
|
47
|
-
sentry_add_breadcrumb_calls = []
|
|
48
|
-
|
|
49
|
-
class TestSentryClient(object):
|
|
50
|
-
def __init__(self, *args, **kwargs):
|
|
51
|
-
sentry_init_args.update(kwargs)
|
|
52
|
-
|
|
53
|
-
def set_context(self, *args, **kwargs):
|
|
54
|
-
pass
|
|
55
|
-
|
|
56
|
-
monkeypatch.setattr("sentry_sdk.Client", TestSentryClient)
|
|
57
|
-
|
|
58
|
-
class TestSentryScope(object):
|
|
59
|
-
def set_context(self, *args, **kwargs):
|
|
60
|
-
pass
|
|
61
|
-
|
|
62
|
-
class TestSentryHub(object):
|
|
63
|
-
def __init__(self, *args, **kwargs):
|
|
64
|
-
self.scope = TestSentryScope()
|
|
65
|
-
|
|
66
|
-
def capture_exception(self, *args, **kwargs):
|
|
67
|
-
sentry_capture_exception_calls.append((args, kwargs))
|
|
68
|
-
|
|
69
|
-
def add_breadcrumb(self, *args, **kwargs):
|
|
70
|
-
sentry_add_breadcrumb_calls.append((args, kwargs))
|
|
71
|
-
|
|
72
|
-
monkeypatch.setattr("sentry_sdk.Hub", TestSentryHub)
|
|
73
|
-
|
|
74
|
-
yield {
|
|
75
|
-
"sentry_init_args": sentry_init_args,
|
|
76
|
-
"sentry_capture_exception_calls": sentry_capture_exception_calls,
|
|
77
|
-
"sentry_add_breadcrumb_calls": sentry_add_breadcrumb_calls,
|
|
78
|
-
"sentry_dsn": sentry_dsn,
|
|
79
|
-
}
|
|
80
23
|
`
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export default () => `import os
|
|
2
2
|
|
|
3
|
-
from seamapi.utils.get_sentry_dsn import get_sentry_dsn
|
|
4
3
|
from .routes import Routes
|
|
5
4
|
import requests
|
|
6
|
-
import sentry_sdk
|
|
7
5
|
import pkg_resources
|
|
8
6
|
from typing import Optional, cast
|
|
9
7
|
from .types import AbstractSeam, SeamApiException
|
|
@@ -12,33 +10,6 @@ from .types import AbstractSeam, SeamApiException
|
|
|
12
10
|
class Seam(AbstractSeam):
|
|
13
11
|
"""
|
|
14
12
|
Initial Seam class used to interact with Seam API
|
|
15
|
-
|
|
16
|
-
...
|
|
17
|
-
|
|
18
|
-
Attributes
|
|
19
|
-
----------
|
|
20
|
-
api_key : str
|
|
21
|
-
API key (default None)
|
|
22
|
-
api_url : str
|
|
23
|
-
API url (default "https://connect.getseam.com")
|
|
24
|
-
lts_version : str
|
|
25
|
-
LTS version
|
|
26
|
-
workspaces : Workspaces
|
|
27
|
-
Workspaces class
|
|
28
|
-
connected_accounts : ConnectedAccounts
|
|
29
|
-
Connected accounts class
|
|
30
|
-
connect_webviews : ConnectWebviews
|
|
31
|
-
Connect webviews class
|
|
32
|
-
devices : Devices
|
|
33
|
-
Devices class
|
|
34
|
-
events : Events
|
|
35
|
-
Events class
|
|
36
|
-
locks : Locks
|
|
37
|
-
Locks class
|
|
38
|
-
access_codes : AccessCodes
|
|
39
|
-
Access codes class
|
|
40
|
-
action_attempts : ActionAttempts
|
|
41
|
-
Action attempts class
|
|
42
13
|
"""
|
|
43
14
|
|
|
44
15
|
api_key: str
|
|
@@ -51,7 +22,6 @@ class Seam(AbstractSeam):
|
|
|
51
22
|
*,
|
|
52
23
|
workspace_id: Optional[str] = None,
|
|
53
24
|
api_url: Optional[str] = None,
|
|
54
|
-
should_report_exceptions: Optional[bool] = False,
|
|
55
25
|
):
|
|
56
26
|
"""
|
|
57
27
|
Parameters
|
|
@@ -62,8 +32,6 @@ class Seam(AbstractSeam):
|
|
|
62
32
|
Workspace id
|
|
63
33
|
api_url : str, optional
|
|
64
34
|
API url
|
|
65
|
-
should_report_exceptions : bool, optional
|
|
66
|
-
Defaults to False. If true, thrown exceptions will be reported to Seam.
|
|
67
35
|
"""
|
|
68
36
|
Routes.__init__(self)
|
|
69
37
|
|
|
@@ -91,18 +59,6 @@ class Seam(AbstractSeam):
|
|
|
91
59
|
if api_url is not None:
|
|
92
60
|
self.api_url = cast(str, api_url)
|
|
93
61
|
|
|
94
|
-
self.should_report_exceptions = should_report_exceptions
|
|
95
|
-
|
|
96
|
-
if self.should_report_exceptions:
|
|
97
|
-
self.sentry_client = sentry_sdk.Hub(sentry_sdk.Client(
|
|
98
|
-
dsn=get_sentry_dsn(),
|
|
99
|
-
))
|
|
100
|
-
self.sentry_client.scope.set_context("sdk_info", {
|
|
101
|
-
"repository": "https://github.com/seamapi/python",
|
|
102
|
-
"version": pkg_resources.get_distribution("seamapi").version,
|
|
103
|
-
"endpoint": self.api_url,
|
|
104
|
-
})
|
|
105
|
-
|
|
106
62
|
def make_request(self, method: str, path: str, **kwargs):
|
|
107
63
|
"""
|
|
108
64
|
Makes a request to the API
|
|
@@ -131,20 +87,6 @@ class Seam(AbstractSeam):
|
|
|
131
87
|
headers["seam-workspace"] = self.workspace_id
|
|
132
88
|
response = requests.request(method, url, headers=headers, **kwargs)
|
|
133
89
|
|
|
134
|
-
if self.should_report_exceptions and response.status_code:
|
|
135
|
-
# Add breadcrumb
|
|
136
|
-
self.sentry_client.add_breadcrumb(
|
|
137
|
-
category="http",
|
|
138
|
-
level="info",
|
|
139
|
-
data={
|
|
140
|
-
"method": method,
|
|
141
|
-
"url": url,
|
|
142
|
-
"status_code": response.status_code,
|
|
143
|
-
"request_id": response.headers.get("seam-request-id", "unknown"),
|
|
144
|
-
},
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
|
|
148
90
|
if response.status_code != 200:
|
|
149
91
|
raise SeamApiException(response)
|
|
150
92
|
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export default () => `import os
|
|
2
|
-
|
|
3
|
-
value = os.environ.get("SENTRY_DSN", "None")
|
|
4
|
-
if value != "None":
|
|
5
|
-
value = f'"{value}"'
|
|
6
|
-
|
|
7
|
-
f = open("seamapi/utils/get_sentry_dsn.py", "w")
|
|
8
|
-
f.write(f"""
|
|
9
|
-
def get_sentry_dsn():
|
|
10
|
-
return {value}
|
|
11
|
-
""")
|
|
12
|
-
`;
|
|
13
|
-
//# sourceMappingURL=prebuild.py.template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prebuild.py.template.js","sourceRoot":"","sources":["../../../src/lib/generate-python-sdk/templates/prebuild.py.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;CAWpB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_sentry_dsn.py.template.js","sourceRoot":"","sources":["../../../../src/lib/generate-python-sdk/templates/utils/get_sentry_dsn.py.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;4CAIuB,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export default () => `from seamapi.types import SeamApiException
|
|
2
|
-
|
|
3
|
-
"""
|
|
4
|
-
A decorator for model methods that will report errors to Sentry (if enabled).
|
|
5
|
-
Expects that the model has a \`seam\` attribute that is a \`Seam\` instance.
|
|
6
|
-
"""
|
|
7
|
-
def report_error(f):
|
|
8
|
-
def wrapper(self, *args, **kwargs):
|
|
9
|
-
try:
|
|
10
|
-
return f(self, *args, **kwargs)
|
|
11
|
-
except Exception as error:
|
|
12
|
-
if self.seam.should_report_exceptions and type(error) is not SeamApiException:
|
|
13
|
-
self.seam.sentry_client.capture_exception(error)
|
|
14
|
-
|
|
15
|
-
raise error
|
|
16
|
-
return wrapper`;
|
|
17
|
-
//# sourceMappingURL=report_error.py.template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"report_error.py.template.js","sourceRoot":"","sources":["../../../../src/lib/generate-python-sdk/templates/utils/report_error.py.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;iBAeJ,CAAA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export default () => `from seamapi.types import SeamApiException
|
|
2
|
-
|
|
3
|
-
"""
|
|
4
|
-
A decorator for model methods that will report errors to Sentry (if enabled).
|
|
5
|
-
Expects that the model has a \`seam\` attribute that is a \`Seam\` instance.
|
|
6
|
-
"""
|
|
7
|
-
def report_error(f):
|
|
8
|
-
def wrapper(self, *args, **kwargs):
|
|
9
|
-
try:
|
|
10
|
-
return f(self, *args, **kwargs)
|
|
11
|
-
except Exception as error:
|
|
12
|
-
if self.seam.should_report_exceptions and type(error) is not SeamApiException:
|
|
13
|
-
self.seam.sentry_client.capture_exception(error)
|
|
14
|
-
|
|
15
|
-
raise error
|
|
16
|
-
return wrapper`
|