permitstack 1.0.0__py3-none-any.whl
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.
- permitstack/__init__.py +17 -0
- permitstack/_hooks/__init__.py +4 -0
- permitstack/_hooks/sdkhooks.py +74 -0
- permitstack/_hooks/types.py +112 -0
- permitstack/_version.py +15 -0
- permitstack/basesdk.py +396 -0
- permitstack/bulk_export.py +241 -0
- permitstack/contractors.py +625 -0
- permitstack/errors/__init__.py +39 -0
- permitstack/errors/httpvalidationerror.py +28 -0
- permitstack/errors/no_response_error.py +17 -0
- permitstack/errors/permitstackdefaulterror.py +40 -0
- permitstack/errors/permitstackerror.py +30 -0
- permitstack/errors/responsevalidationerror.py +27 -0
- permitstack/health.py +171 -0
- permitstack/httpclient.py +125 -0
- permitstack/models/__init__.py +158 -0
- permitstack/models/contractorprofile.py +108 -0
- permitstack/models/contractorsearchresponse.py +24 -0
- permitstack/models/contractorsummary.py +57 -0
- permitstack/models/delete_webhookop.py +16 -0
- permitstack/models/export_permits_csvop.py +98 -0
- permitstack/models/get_contractor_permitsop.py +46 -0
- permitstack/models/get_contractorop.py +16 -0
- permitstack/models/get_permitop.py +16 -0
- permitstack/models/get_permits_by_addressop.py +46 -0
- permitstack/models/get_property_historyop.py +18 -0
- permitstack/models/permitcategory.py +27 -0
- permitstack/models/permitdetail.py +164 -0
- permitstack/models/permitsearchresponse.py +24 -0
- permitstack/models/permitstatus.py +16 -0
- permitstack/models/permitsummary.py +121 -0
- permitstack/models/propertytype.py +14 -0
- permitstack/models/search_contractorsop.py +98 -0
- permitstack/models/search_permitsop.py +247 -0
- permitstack/models/security.py +42 -0
- permitstack/models/validationerror.py +57 -0
- permitstack/models/webhookcreate.py +60 -0
- permitstack/permits.py +866 -0
- permitstack/property_history.py +207 -0
- permitstack/py.typed +1 -0
- permitstack/sdk.py +218 -0
- permitstack/sdkconfiguration.py +49 -0
- permitstack/types/__init__.py +21 -0
- permitstack/types/basemodel.py +77 -0
- permitstack/utils/__init__.py +178 -0
- permitstack/utils/annotations.py +79 -0
- permitstack/utils/datetimes.py +23 -0
- permitstack/utils/dynamic_imports.py +54 -0
- permitstack/utils/enums.py +134 -0
- permitstack/utils/eventstreaming.py +309 -0
- permitstack/utils/forms.py +234 -0
- permitstack/utils/headers.py +136 -0
- permitstack/utils/logger.py +27 -0
- permitstack/utils/metadata.py +119 -0
- permitstack/utils/queryparams.py +217 -0
- permitstack/utils/requestbodies.py +66 -0
- permitstack/utils/retries.py +271 -0
- permitstack/utils/security.py +215 -0
- permitstack/utils/serializers.py +225 -0
- permitstack/utils/unmarshal_json_response.py +38 -0
- permitstack/utils/url.py +155 -0
- permitstack/utils/values.py +137 -0
- permitstack/webhooks.py +593 -0
- permitstack-1.0.0.dist-info/METADATA +541 -0
- permitstack-1.0.0.dist-info/RECORD +68 -0
- permitstack-1.0.0.dist-info/WHEEL +5 -0
- permitstack-1.0.0.dist-info/top_level.txt +1 -0
permitstack/permits.py
ADDED
|
@@ -0,0 +1,866 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .basesdk import BaseSDK
|
|
4
|
+
from datetime import date
|
|
5
|
+
from permitstack import errors, models, utils
|
|
6
|
+
from permitstack._hooks import HookContext
|
|
7
|
+
from permitstack.types import OptionalNullable, UNSET
|
|
8
|
+
from permitstack.utils import get_security_from_env
|
|
9
|
+
from permitstack.utils.unmarshal_json_response import unmarshal_json_response
|
|
10
|
+
from typing import Any, Mapping, Optional
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Permits(BaseSDK):
|
|
14
|
+
r"""Search and retrieve building permits"""
|
|
15
|
+
|
|
16
|
+
def search_permits(
|
|
17
|
+
self,
|
|
18
|
+
*,
|
|
19
|
+
zip_code: OptionalNullable[str] = UNSET,
|
|
20
|
+
city: OptionalNullable[str] = UNSET,
|
|
21
|
+
state: OptionalNullable[str] = UNSET,
|
|
22
|
+
lat: OptionalNullable[float] = UNSET,
|
|
23
|
+
lng: OptionalNullable[float] = UNSET,
|
|
24
|
+
radius_miles: Optional[float] = 5,
|
|
25
|
+
category: OptionalNullable[models.PermitCategory] = UNSET,
|
|
26
|
+
status: OptionalNullable[models.PermitStatus] = UNSET,
|
|
27
|
+
property_type: OptionalNullable[models.PropertyType] = UNSET,
|
|
28
|
+
tag: OptionalNullable[str] = UNSET,
|
|
29
|
+
filed_after: OptionalNullable[date] = UNSET,
|
|
30
|
+
filed_before: OptionalNullable[date] = UNSET,
|
|
31
|
+
issued_after: OptionalNullable[date] = UNSET,
|
|
32
|
+
issued_before: OptionalNullable[date] = UNSET,
|
|
33
|
+
min_value: OptionalNullable[float] = UNSET,
|
|
34
|
+
max_value: OptionalNullable[float] = UNSET,
|
|
35
|
+
q: OptionalNullable[str] = UNSET,
|
|
36
|
+
contractor_name: OptionalNullable[str] = UNSET,
|
|
37
|
+
page: Optional[int] = 1,
|
|
38
|
+
per_page: Optional[int] = 25,
|
|
39
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
40
|
+
server_url: Optional[str] = None,
|
|
41
|
+
timeout_ms: Optional[int] = None,
|
|
42
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
43
|
+
) -> models.PermitSearchResponse:
|
|
44
|
+
r"""Search Permits
|
|
45
|
+
|
|
46
|
+
Search permits with flexible filtering.
|
|
47
|
+
|
|
48
|
+
:param zip_code: 5-digit ZIP code
|
|
49
|
+
:param city: City name
|
|
50
|
+
:param state: 2-letter state code
|
|
51
|
+
:param lat: Latitude for radius search
|
|
52
|
+
:param lng: Longitude for radius search
|
|
53
|
+
:param radius_miles: Radius in miles (used with lat/lng)
|
|
54
|
+
:param category: Permit category (e.g. solar, roofing, hvac)
|
|
55
|
+
:param status: Permit status (e.g. issued, filed, final)
|
|
56
|
+
:param property_type: Property type (e.g. residential, commercial)
|
|
57
|
+
:param tag: Filter by tag
|
|
58
|
+
:param filed_after: Filed on or after this date
|
|
59
|
+
:param filed_before: Filed on or before this date
|
|
60
|
+
:param issued_after: Issued on or after this date
|
|
61
|
+
:param issued_before: Issued on or before this date
|
|
62
|
+
:param min_value: Minimum estimated value
|
|
63
|
+
:param max_value: Maximum estimated value
|
|
64
|
+
:param q: Full-text search query
|
|
65
|
+
:param contractor_name: Contractor name (partial match)
|
|
66
|
+
:param page:
|
|
67
|
+
:param per_page:
|
|
68
|
+
:param retries: Override the default retry configuration for this method
|
|
69
|
+
:param server_url: Override the default server URL for this method
|
|
70
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
71
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
72
|
+
"""
|
|
73
|
+
base_url = None
|
|
74
|
+
url_variables = None
|
|
75
|
+
if timeout_ms is None:
|
|
76
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
77
|
+
|
|
78
|
+
if server_url is not None:
|
|
79
|
+
base_url = server_url
|
|
80
|
+
else:
|
|
81
|
+
base_url = self._get_url(base_url, url_variables)
|
|
82
|
+
|
|
83
|
+
request = models.SearchPermitsRequest(
|
|
84
|
+
zip_code=zip_code,
|
|
85
|
+
city=city,
|
|
86
|
+
state=state,
|
|
87
|
+
lat=lat,
|
|
88
|
+
lng=lng,
|
|
89
|
+
radius_miles=radius_miles,
|
|
90
|
+
category=category,
|
|
91
|
+
status=status,
|
|
92
|
+
property_type=property_type,
|
|
93
|
+
tag=tag,
|
|
94
|
+
filed_after=filed_after,
|
|
95
|
+
filed_before=filed_before,
|
|
96
|
+
issued_after=issued_after,
|
|
97
|
+
issued_before=issued_before,
|
|
98
|
+
min_value=min_value,
|
|
99
|
+
max_value=max_value,
|
|
100
|
+
q=q,
|
|
101
|
+
contractor_name=contractor_name,
|
|
102
|
+
page=page,
|
|
103
|
+
per_page=per_page,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
req = self._build_request(
|
|
107
|
+
method="GET",
|
|
108
|
+
path="/v1/permits/search",
|
|
109
|
+
base_url=base_url,
|
|
110
|
+
url_variables=url_variables,
|
|
111
|
+
request=request,
|
|
112
|
+
request_body_required=False,
|
|
113
|
+
request_has_path_params=False,
|
|
114
|
+
request_has_query_params=True,
|
|
115
|
+
user_agent_header="user-agent",
|
|
116
|
+
accept_header_value="application/json",
|
|
117
|
+
http_headers=http_headers,
|
|
118
|
+
security=self.sdk_configuration.security,
|
|
119
|
+
allow_empty_value=None,
|
|
120
|
+
timeout_ms=timeout_ms,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
if retries == UNSET:
|
|
124
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
125
|
+
retries = self.sdk_configuration.retry_config
|
|
126
|
+
|
|
127
|
+
retry_config = None
|
|
128
|
+
if isinstance(retries, utils.RetryConfig):
|
|
129
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
130
|
+
|
|
131
|
+
http_res = self.do_request(
|
|
132
|
+
hook_ctx=HookContext(
|
|
133
|
+
config=self.sdk_configuration,
|
|
134
|
+
base_url=base_url or "",
|
|
135
|
+
operation_id="search_permits",
|
|
136
|
+
oauth2_scopes=None,
|
|
137
|
+
security_source=get_security_from_env(
|
|
138
|
+
self.sdk_configuration.security, models.Security
|
|
139
|
+
),
|
|
140
|
+
),
|
|
141
|
+
request=req,
|
|
142
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
143
|
+
retry_config=retry_config,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
response_data: Any = None
|
|
147
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
148
|
+
return unmarshal_json_response(models.PermitSearchResponse, http_res)
|
|
149
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
150
|
+
response_data = unmarshal_json_response(
|
|
151
|
+
errors.HTTPValidationErrorData, http_res
|
|
152
|
+
)
|
|
153
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
154
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
155
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
156
|
+
raise errors.PermitstackDefaultError(
|
|
157
|
+
"API error occurred", http_res, http_res_text
|
|
158
|
+
)
|
|
159
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
160
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
161
|
+
raise errors.PermitstackDefaultError(
|
|
162
|
+
"API error occurred", http_res, http_res_text
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
raise errors.PermitstackDefaultError("Unexpected response received", http_res)
|
|
166
|
+
|
|
167
|
+
async def search_permits_async(
|
|
168
|
+
self,
|
|
169
|
+
*,
|
|
170
|
+
zip_code: OptionalNullable[str] = UNSET,
|
|
171
|
+
city: OptionalNullable[str] = UNSET,
|
|
172
|
+
state: OptionalNullable[str] = UNSET,
|
|
173
|
+
lat: OptionalNullable[float] = UNSET,
|
|
174
|
+
lng: OptionalNullable[float] = UNSET,
|
|
175
|
+
radius_miles: Optional[float] = 5,
|
|
176
|
+
category: OptionalNullable[models.PermitCategory] = UNSET,
|
|
177
|
+
status: OptionalNullable[models.PermitStatus] = UNSET,
|
|
178
|
+
property_type: OptionalNullable[models.PropertyType] = UNSET,
|
|
179
|
+
tag: OptionalNullable[str] = UNSET,
|
|
180
|
+
filed_after: OptionalNullable[date] = UNSET,
|
|
181
|
+
filed_before: OptionalNullable[date] = UNSET,
|
|
182
|
+
issued_after: OptionalNullable[date] = UNSET,
|
|
183
|
+
issued_before: OptionalNullable[date] = UNSET,
|
|
184
|
+
min_value: OptionalNullable[float] = UNSET,
|
|
185
|
+
max_value: OptionalNullable[float] = UNSET,
|
|
186
|
+
q: OptionalNullable[str] = UNSET,
|
|
187
|
+
contractor_name: OptionalNullable[str] = UNSET,
|
|
188
|
+
page: Optional[int] = 1,
|
|
189
|
+
per_page: Optional[int] = 25,
|
|
190
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
191
|
+
server_url: Optional[str] = None,
|
|
192
|
+
timeout_ms: Optional[int] = None,
|
|
193
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
194
|
+
) -> models.PermitSearchResponse:
|
|
195
|
+
r"""Search Permits
|
|
196
|
+
|
|
197
|
+
Search permits with flexible filtering.
|
|
198
|
+
|
|
199
|
+
:param zip_code: 5-digit ZIP code
|
|
200
|
+
:param city: City name
|
|
201
|
+
:param state: 2-letter state code
|
|
202
|
+
:param lat: Latitude for radius search
|
|
203
|
+
:param lng: Longitude for radius search
|
|
204
|
+
:param radius_miles: Radius in miles (used with lat/lng)
|
|
205
|
+
:param category: Permit category (e.g. solar, roofing, hvac)
|
|
206
|
+
:param status: Permit status (e.g. issued, filed, final)
|
|
207
|
+
:param property_type: Property type (e.g. residential, commercial)
|
|
208
|
+
:param tag: Filter by tag
|
|
209
|
+
:param filed_after: Filed on or after this date
|
|
210
|
+
:param filed_before: Filed on or before this date
|
|
211
|
+
:param issued_after: Issued on or after this date
|
|
212
|
+
:param issued_before: Issued on or before this date
|
|
213
|
+
:param min_value: Minimum estimated value
|
|
214
|
+
:param max_value: Maximum estimated value
|
|
215
|
+
:param q: Full-text search query
|
|
216
|
+
:param contractor_name: Contractor name (partial match)
|
|
217
|
+
:param page:
|
|
218
|
+
:param per_page:
|
|
219
|
+
:param retries: Override the default retry configuration for this method
|
|
220
|
+
:param server_url: Override the default server URL for this method
|
|
221
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
222
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
223
|
+
"""
|
|
224
|
+
base_url = None
|
|
225
|
+
url_variables = None
|
|
226
|
+
if timeout_ms is None:
|
|
227
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
228
|
+
|
|
229
|
+
if server_url is not None:
|
|
230
|
+
base_url = server_url
|
|
231
|
+
else:
|
|
232
|
+
base_url = self._get_url(base_url, url_variables)
|
|
233
|
+
|
|
234
|
+
request = models.SearchPermitsRequest(
|
|
235
|
+
zip_code=zip_code,
|
|
236
|
+
city=city,
|
|
237
|
+
state=state,
|
|
238
|
+
lat=lat,
|
|
239
|
+
lng=lng,
|
|
240
|
+
radius_miles=radius_miles,
|
|
241
|
+
category=category,
|
|
242
|
+
status=status,
|
|
243
|
+
property_type=property_type,
|
|
244
|
+
tag=tag,
|
|
245
|
+
filed_after=filed_after,
|
|
246
|
+
filed_before=filed_before,
|
|
247
|
+
issued_after=issued_after,
|
|
248
|
+
issued_before=issued_before,
|
|
249
|
+
min_value=min_value,
|
|
250
|
+
max_value=max_value,
|
|
251
|
+
q=q,
|
|
252
|
+
contractor_name=contractor_name,
|
|
253
|
+
page=page,
|
|
254
|
+
per_page=per_page,
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
req = self._build_request_async(
|
|
258
|
+
method="GET",
|
|
259
|
+
path="/v1/permits/search",
|
|
260
|
+
base_url=base_url,
|
|
261
|
+
url_variables=url_variables,
|
|
262
|
+
request=request,
|
|
263
|
+
request_body_required=False,
|
|
264
|
+
request_has_path_params=False,
|
|
265
|
+
request_has_query_params=True,
|
|
266
|
+
user_agent_header="user-agent",
|
|
267
|
+
accept_header_value="application/json",
|
|
268
|
+
http_headers=http_headers,
|
|
269
|
+
security=self.sdk_configuration.security,
|
|
270
|
+
allow_empty_value=None,
|
|
271
|
+
timeout_ms=timeout_ms,
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
if retries == UNSET:
|
|
275
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
276
|
+
retries = self.sdk_configuration.retry_config
|
|
277
|
+
|
|
278
|
+
retry_config = None
|
|
279
|
+
if isinstance(retries, utils.RetryConfig):
|
|
280
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
281
|
+
|
|
282
|
+
http_res = await self.do_request_async(
|
|
283
|
+
hook_ctx=HookContext(
|
|
284
|
+
config=self.sdk_configuration,
|
|
285
|
+
base_url=base_url or "",
|
|
286
|
+
operation_id="search_permits",
|
|
287
|
+
oauth2_scopes=None,
|
|
288
|
+
security_source=get_security_from_env(
|
|
289
|
+
self.sdk_configuration.security, models.Security
|
|
290
|
+
),
|
|
291
|
+
),
|
|
292
|
+
request=req,
|
|
293
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
294
|
+
retry_config=retry_config,
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
response_data: Any = None
|
|
298
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
299
|
+
return unmarshal_json_response(models.PermitSearchResponse, http_res)
|
|
300
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
301
|
+
response_data = unmarshal_json_response(
|
|
302
|
+
errors.HTTPValidationErrorData, http_res
|
|
303
|
+
)
|
|
304
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
305
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
306
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
307
|
+
raise errors.PermitstackDefaultError(
|
|
308
|
+
"API error occurred", http_res, http_res_text
|
|
309
|
+
)
|
|
310
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
311
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
312
|
+
raise errors.PermitstackDefaultError(
|
|
313
|
+
"API error occurred", http_res, http_res_text
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
raise errors.PermitstackDefaultError("Unexpected response received", http_res)
|
|
317
|
+
|
|
318
|
+
def get_permit(
|
|
319
|
+
self,
|
|
320
|
+
*,
|
|
321
|
+
permit_id: str,
|
|
322
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
323
|
+
server_url: Optional[str] = None,
|
|
324
|
+
timeout_ms: Optional[int] = None,
|
|
325
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
326
|
+
) -> models.PermitDetail:
|
|
327
|
+
r"""Get Permit
|
|
328
|
+
|
|
329
|
+
Get full details for a single permit.
|
|
330
|
+
|
|
331
|
+
:param permit_id:
|
|
332
|
+
:param retries: Override the default retry configuration for this method
|
|
333
|
+
:param server_url: Override the default server URL for this method
|
|
334
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
335
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
336
|
+
"""
|
|
337
|
+
base_url = None
|
|
338
|
+
url_variables = None
|
|
339
|
+
if timeout_ms is None:
|
|
340
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
341
|
+
|
|
342
|
+
if server_url is not None:
|
|
343
|
+
base_url = server_url
|
|
344
|
+
else:
|
|
345
|
+
base_url = self._get_url(base_url, url_variables)
|
|
346
|
+
|
|
347
|
+
request = models.GetPermitRequest(
|
|
348
|
+
permit_id=permit_id,
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
req = self._build_request(
|
|
352
|
+
method="GET",
|
|
353
|
+
path="/v1/permits/{permit_id}",
|
|
354
|
+
base_url=base_url,
|
|
355
|
+
url_variables=url_variables,
|
|
356
|
+
request=request,
|
|
357
|
+
request_body_required=False,
|
|
358
|
+
request_has_path_params=True,
|
|
359
|
+
request_has_query_params=True,
|
|
360
|
+
user_agent_header="user-agent",
|
|
361
|
+
accept_header_value="application/json",
|
|
362
|
+
http_headers=http_headers,
|
|
363
|
+
security=self.sdk_configuration.security,
|
|
364
|
+
allow_empty_value=None,
|
|
365
|
+
timeout_ms=timeout_ms,
|
|
366
|
+
)
|
|
367
|
+
|
|
368
|
+
if retries == UNSET:
|
|
369
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
370
|
+
retries = self.sdk_configuration.retry_config
|
|
371
|
+
|
|
372
|
+
retry_config = None
|
|
373
|
+
if isinstance(retries, utils.RetryConfig):
|
|
374
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
375
|
+
|
|
376
|
+
http_res = self.do_request(
|
|
377
|
+
hook_ctx=HookContext(
|
|
378
|
+
config=self.sdk_configuration,
|
|
379
|
+
base_url=base_url or "",
|
|
380
|
+
operation_id="get_permit",
|
|
381
|
+
oauth2_scopes=None,
|
|
382
|
+
security_source=get_security_from_env(
|
|
383
|
+
self.sdk_configuration.security, models.Security
|
|
384
|
+
),
|
|
385
|
+
),
|
|
386
|
+
request=req,
|
|
387
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
388
|
+
retry_config=retry_config,
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
response_data: Any = None
|
|
392
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
393
|
+
return unmarshal_json_response(models.PermitDetail, http_res)
|
|
394
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
395
|
+
response_data = unmarshal_json_response(
|
|
396
|
+
errors.HTTPValidationErrorData, http_res
|
|
397
|
+
)
|
|
398
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
399
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
400
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
401
|
+
raise errors.PermitstackDefaultError(
|
|
402
|
+
"API error occurred", http_res, http_res_text
|
|
403
|
+
)
|
|
404
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
405
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
406
|
+
raise errors.PermitstackDefaultError(
|
|
407
|
+
"API error occurred", http_res, http_res_text
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
raise errors.PermitstackDefaultError("Unexpected response received", http_res)
|
|
411
|
+
|
|
412
|
+
async def get_permit_async(
|
|
413
|
+
self,
|
|
414
|
+
*,
|
|
415
|
+
permit_id: str,
|
|
416
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
417
|
+
server_url: Optional[str] = None,
|
|
418
|
+
timeout_ms: Optional[int] = None,
|
|
419
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
420
|
+
) -> models.PermitDetail:
|
|
421
|
+
r"""Get Permit
|
|
422
|
+
|
|
423
|
+
Get full details for a single permit.
|
|
424
|
+
|
|
425
|
+
:param permit_id:
|
|
426
|
+
:param retries: Override the default retry configuration for this method
|
|
427
|
+
:param server_url: Override the default server URL for this method
|
|
428
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
429
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
430
|
+
"""
|
|
431
|
+
base_url = None
|
|
432
|
+
url_variables = None
|
|
433
|
+
if timeout_ms is None:
|
|
434
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
435
|
+
|
|
436
|
+
if server_url is not None:
|
|
437
|
+
base_url = server_url
|
|
438
|
+
else:
|
|
439
|
+
base_url = self._get_url(base_url, url_variables)
|
|
440
|
+
|
|
441
|
+
request = models.GetPermitRequest(
|
|
442
|
+
permit_id=permit_id,
|
|
443
|
+
)
|
|
444
|
+
|
|
445
|
+
req = self._build_request_async(
|
|
446
|
+
method="GET",
|
|
447
|
+
path="/v1/permits/{permit_id}",
|
|
448
|
+
base_url=base_url,
|
|
449
|
+
url_variables=url_variables,
|
|
450
|
+
request=request,
|
|
451
|
+
request_body_required=False,
|
|
452
|
+
request_has_path_params=True,
|
|
453
|
+
request_has_query_params=True,
|
|
454
|
+
user_agent_header="user-agent",
|
|
455
|
+
accept_header_value="application/json",
|
|
456
|
+
http_headers=http_headers,
|
|
457
|
+
security=self.sdk_configuration.security,
|
|
458
|
+
allow_empty_value=None,
|
|
459
|
+
timeout_ms=timeout_ms,
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
if retries == UNSET:
|
|
463
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
464
|
+
retries = self.sdk_configuration.retry_config
|
|
465
|
+
|
|
466
|
+
retry_config = None
|
|
467
|
+
if isinstance(retries, utils.RetryConfig):
|
|
468
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
469
|
+
|
|
470
|
+
http_res = await self.do_request_async(
|
|
471
|
+
hook_ctx=HookContext(
|
|
472
|
+
config=self.sdk_configuration,
|
|
473
|
+
base_url=base_url or "",
|
|
474
|
+
operation_id="get_permit",
|
|
475
|
+
oauth2_scopes=None,
|
|
476
|
+
security_source=get_security_from_env(
|
|
477
|
+
self.sdk_configuration.security, models.Security
|
|
478
|
+
),
|
|
479
|
+
),
|
|
480
|
+
request=req,
|
|
481
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
482
|
+
retry_config=retry_config,
|
|
483
|
+
)
|
|
484
|
+
|
|
485
|
+
response_data: Any = None
|
|
486
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
487
|
+
return unmarshal_json_response(models.PermitDetail, http_res)
|
|
488
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
489
|
+
response_data = unmarshal_json_response(
|
|
490
|
+
errors.HTTPValidationErrorData, http_res
|
|
491
|
+
)
|
|
492
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
493
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
494
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
495
|
+
raise errors.PermitstackDefaultError(
|
|
496
|
+
"API error occurred", http_res, http_res_text
|
|
497
|
+
)
|
|
498
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
499
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
500
|
+
raise errors.PermitstackDefaultError(
|
|
501
|
+
"API error occurred", http_res, http_res_text
|
|
502
|
+
)
|
|
503
|
+
|
|
504
|
+
raise errors.PermitstackDefaultError("Unexpected response received", http_res)
|
|
505
|
+
|
|
506
|
+
def get_permits_by_address(
|
|
507
|
+
self,
|
|
508
|
+
*,
|
|
509
|
+
address: str,
|
|
510
|
+
page: Optional[int] = 1,
|
|
511
|
+
per_page: Optional[int] = 25,
|
|
512
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
513
|
+
server_url: Optional[str] = None,
|
|
514
|
+
timeout_ms: Optional[int] = None,
|
|
515
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
516
|
+
) -> models.PermitSearchResponse:
|
|
517
|
+
r"""Get Permits By Address
|
|
518
|
+
|
|
519
|
+
Get all permits for a specific address (partial match).
|
|
520
|
+
|
|
521
|
+
:param address:
|
|
522
|
+
:param page:
|
|
523
|
+
:param per_page:
|
|
524
|
+
:param retries: Override the default retry configuration for this method
|
|
525
|
+
:param server_url: Override the default server URL for this method
|
|
526
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
527
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
528
|
+
"""
|
|
529
|
+
base_url = None
|
|
530
|
+
url_variables = None
|
|
531
|
+
if timeout_ms is None:
|
|
532
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
533
|
+
|
|
534
|
+
if server_url is not None:
|
|
535
|
+
base_url = server_url
|
|
536
|
+
else:
|
|
537
|
+
base_url = self._get_url(base_url, url_variables)
|
|
538
|
+
|
|
539
|
+
request = models.GetPermitsByAddressRequest(
|
|
540
|
+
address=address,
|
|
541
|
+
page=page,
|
|
542
|
+
per_page=per_page,
|
|
543
|
+
)
|
|
544
|
+
|
|
545
|
+
req = self._build_request(
|
|
546
|
+
method="GET",
|
|
547
|
+
path="/v1/permits/address/{address}",
|
|
548
|
+
base_url=base_url,
|
|
549
|
+
url_variables=url_variables,
|
|
550
|
+
request=request,
|
|
551
|
+
request_body_required=False,
|
|
552
|
+
request_has_path_params=True,
|
|
553
|
+
request_has_query_params=True,
|
|
554
|
+
user_agent_header="user-agent",
|
|
555
|
+
accept_header_value="application/json",
|
|
556
|
+
http_headers=http_headers,
|
|
557
|
+
security=self.sdk_configuration.security,
|
|
558
|
+
allow_empty_value=None,
|
|
559
|
+
timeout_ms=timeout_ms,
|
|
560
|
+
)
|
|
561
|
+
|
|
562
|
+
if retries == UNSET:
|
|
563
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
564
|
+
retries = self.sdk_configuration.retry_config
|
|
565
|
+
|
|
566
|
+
retry_config = None
|
|
567
|
+
if isinstance(retries, utils.RetryConfig):
|
|
568
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
569
|
+
|
|
570
|
+
http_res = self.do_request(
|
|
571
|
+
hook_ctx=HookContext(
|
|
572
|
+
config=self.sdk_configuration,
|
|
573
|
+
base_url=base_url or "",
|
|
574
|
+
operation_id="get_permits_by_address",
|
|
575
|
+
oauth2_scopes=None,
|
|
576
|
+
security_source=get_security_from_env(
|
|
577
|
+
self.sdk_configuration.security, models.Security
|
|
578
|
+
),
|
|
579
|
+
),
|
|
580
|
+
request=req,
|
|
581
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
582
|
+
retry_config=retry_config,
|
|
583
|
+
)
|
|
584
|
+
|
|
585
|
+
response_data: Any = None
|
|
586
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
587
|
+
return unmarshal_json_response(models.PermitSearchResponse, http_res)
|
|
588
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
589
|
+
response_data = unmarshal_json_response(
|
|
590
|
+
errors.HTTPValidationErrorData, http_res
|
|
591
|
+
)
|
|
592
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
593
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
594
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
595
|
+
raise errors.PermitstackDefaultError(
|
|
596
|
+
"API error occurred", http_res, http_res_text
|
|
597
|
+
)
|
|
598
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
599
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
600
|
+
raise errors.PermitstackDefaultError(
|
|
601
|
+
"API error occurred", http_res, http_res_text
|
|
602
|
+
)
|
|
603
|
+
|
|
604
|
+
raise errors.PermitstackDefaultError("Unexpected response received", http_res)
|
|
605
|
+
|
|
606
|
+
async def get_permits_by_address_async(
|
|
607
|
+
self,
|
|
608
|
+
*,
|
|
609
|
+
address: str,
|
|
610
|
+
page: Optional[int] = 1,
|
|
611
|
+
per_page: Optional[int] = 25,
|
|
612
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
613
|
+
server_url: Optional[str] = None,
|
|
614
|
+
timeout_ms: Optional[int] = None,
|
|
615
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
616
|
+
) -> models.PermitSearchResponse:
|
|
617
|
+
r"""Get Permits By Address
|
|
618
|
+
|
|
619
|
+
Get all permits for a specific address (partial match).
|
|
620
|
+
|
|
621
|
+
:param address:
|
|
622
|
+
:param page:
|
|
623
|
+
:param per_page:
|
|
624
|
+
:param retries: Override the default retry configuration for this method
|
|
625
|
+
:param server_url: Override the default server URL for this method
|
|
626
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
627
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
628
|
+
"""
|
|
629
|
+
base_url = None
|
|
630
|
+
url_variables = None
|
|
631
|
+
if timeout_ms is None:
|
|
632
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
633
|
+
|
|
634
|
+
if server_url is not None:
|
|
635
|
+
base_url = server_url
|
|
636
|
+
else:
|
|
637
|
+
base_url = self._get_url(base_url, url_variables)
|
|
638
|
+
|
|
639
|
+
request = models.GetPermitsByAddressRequest(
|
|
640
|
+
address=address,
|
|
641
|
+
page=page,
|
|
642
|
+
per_page=per_page,
|
|
643
|
+
)
|
|
644
|
+
|
|
645
|
+
req = self._build_request_async(
|
|
646
|
+
method="GET",
|
|
647
|
+
path="/v1/permits/address/{address}",
|
|
648
|
+
base_url=base_url,
|
|
649
|
+
url_variables=url_variables,
|
|
650
|
+
request=request,
|
|
651
|
+
request_body_required=False,
|
|
652
|
+
request_has_path_params=True,
|
|
653
|
+
request_has_query_params=True,
|
|
654
|
+
user_agent_header="user-agent",
|
|
655
|
+
accept_header_value="application/json",
|
|
656
|
+
http_headers=http_headers,
|
|
657
|
+
security=self.sdk_configuration.security,
|
|
658
|
+
allow_empty_value=None,
|
|
659
|
+
timeout_ms=timeout_ms,
|
|
660
|
+
)
|
|
661
|
+
|
|
662
|
+
if retries == UNSET:
|
|
663
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
664
|
+
retries = self.sdk_configuration.retry_config
|
|
665
|
+
|
|
666
|
+
retry_config = None
|
|
667
|
+
if isinstance(retries, utils.RetryConfig):
|
|
668
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
669
|
+
|
|
670
|
+
http_res = await self.do_request_async(
|
|
671
|
+
hook_ctx=HookContext(
|
|
672
|
+
config=self.sdk_configuration,
|
|
673
|
+
base_url=base_url or "",
|
|
674
|
+
operation_id="get_permits_by_address",
|
|
675
|
+
oauth2_scopes=None,
|
|
676
|
+
security_source=get_security_from_env(
|
|
677
|
+
self.sdk_configuration.security, models.Security
|
|
678
|
+
),
|
|
679
|
+
),
|
|
680
|
+
request=req,
|
|
681
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
682
|
+
retry_config=retry_config,
|
|
683
|
+
)
|
|
684
|
+
|
|
685
|
+
response_data: Any = None
|
|
686
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
687
|
+
return unmarshal_json_response(models.PermitSearchResponse, http_res)
|
|
688
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
689
|
+
response_data = unmarshal_json_response(
|
|
690
|
+
errors.HTTPValidationErrorData, http_res
|
|
691
|
+
)
|
|
692
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
693
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
694
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
695
|
+
raise errors.PermitstackDefaultError(
|
|
696
|
+
"API error occurred", http_res, http_res_text
|
|
697
|
+
)
|
|
698
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
699
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
700
|
+
raise errors.PermitstackDefaultError(
|
|
701
|
+
"API error occurred", http_res, http_res_text
|
|
702
|
+
)
|
|
703
|
+
|
|
704
|
+
raise errors.PermitstackDefaultError("Unexpected response received", http_res)
|
|
705
|
+
|
|
706
|
+
def get_coverage_stats(
|
|
707
|
+
self,
|
|
708
|
+
*,
|
|
709
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
710
|
+
server_url: Optional[str] = None,
|
|
711
|
+
timeout_ms: Optional[int] = None,
|
|
712
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
713
|
+
) -> Any:
|
|
714
|
+
r"""Get Coverage Stats
|
|
715
|
+
|
|
716
|
+
Get coverage statistics — total permits, jurisdictions, and breakdown by city.
|
|
717
|
+
|
|
718
|
+
:param retries: Override the default retry configuration for this method
|
|
719
|
+
:param server_url: Override the default server URL for this method
|
|
720
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
721
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
722
|
+
"""
|
|
723
|
+
base_url = None
|
|
724
|
+
url_variables = None
|
|
725
|
+
if timeout_ms is None:
|
|
726
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
727
|
+
|
|
728
|
+
if server_url is not None:
|
|
729
|
+
base_url = server_url
|
|
730
|
+
else:
|
|
731
|
+
base_url = self._get_url(base_url, url_variables)
|
|
732
|
+
req = self._build_request(
|
|
733
|
+
method="GET",
|
|
734
|
+
path="/v1/permits/stats/coverage",
|
|
735
|
+
base_url=base_url,
|
|
736
|
+
url_variables=url_variables,
|
|
737
|
+
request=None,
|
|
738
|
+
request_body_required=False,
|
|
739
|
+
request_has_path_params=False,
|
|
740
|
+
request_has_query_params=True,
|
|
741
|
+
user_agent_header="user-agent",
|
|
742
|
+
accept_header_value="application/json",
|
|
743
|
+
http_headers=http_headers,
|
|
744
|
+
security=self.sdk_configuration.security,
|
|
745
|
+
allow_empty_value=None,
|
|
746
|
+
timeout_ms=timeout_ms,
|
|
747
|
+
)
|
|
748
|
+
|
|
749
|
+
if retries == UNSET:
|
|
750
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
751
|
+
retries = self.sdk_configuration.retry_config
|
|
752
|
+
|
|
753
|
+
retry_config = None
|
|
754
|
+
if isinstance(retries, utils.RetryConfig):
|
|
755
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
756
|
+
|
|
757
|
+
http_res = self.do_request(
|
|
758
|
+
hook_ctx=HookContext(
|
|
759
|
+
config=self.sdk_configuration,
|
|
760
|
+
base_url=base_url or "",
|
|
761
|
+
operation_id="get_coverage_stats",
|
|
762
|
+
oauth2_scopes=None,
|
|
763
|
+
security_source=get_security_from_env(
|
|
764
|
+
self.sdk_configuration.security, models.Security
|
|
765
|
+
),
|
|
766
|
+
),
|
|
767
|
+
request=req,
|
|
768
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
769
|
+
retry_config=retry_config,
|
|
770
|
+
)
|
|
771
|
+
|
|
772
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
773
|
+
return unmarshal_json_response(Any, http_res)
|
|
774
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
775
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
776
|
+
raise errors.PermitstackDefaultError(
|
|
777
|
+
"API error occurred", http_res, http_res_text
|
|
778
|
+
)
|
|
779
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
780
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
781
|
+
raise errors.PermitstackDefaultError(
|
|
782
|
+
"API error occurred", http_res, http_res_text
|
|
783
|
+
)
|
|
784
|
+
|
|
785
|
+
raise errors.PermitstackDefaultError("Unexpected response received", http_res)
|
|
786
|
+
|
|
787
|
+
async def get_coverage_stats_async(
|
|
788
|
+
self,
|
|
789
|
+
*,
|
|
790
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
791
|
+
server_url: Optional[str] = None,
|
|
792
|
+
timeout_ms: Optional[int] = None,
|
|
793
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
794
|
+
) -> Any:
|
|
795
|
+
r"""Get Coverage Stats
|
|
796
|
+
|
|
797
|
+
Get coverage statistics — total permits, jurisdictions, and breakdown by city.
|
|
798
|
+
|
|
799
|
+
:param retries: Override the default retry configuration for this method
|
|
800
|
+
:param server_url: Override the default server URL for this method
|
|
801
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
802
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
803
|
+
"""
|
|
804
|
+
base_url = None
|
|
805
|
+
url_variables = None
|
|
806
|
+
if timeout_ms is None:
|
|
807
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
808
|
+
|
|
809
|
+
if server_url is not None:
|
|
810
|
+
base_url = server_url
|
|
811
|
+
else:
|
|
812
|
+
base_url = self._get_url(base_url, url_variables)
|
|
813
|
+
req = self._build_request_async(
|
|
814
|
+
method="GET",
|
|
815
|
+
path="/v1/permits/stats/coverage",
|
|
816
|
+
base_url=base_url,
|
|
817
|
+
url_variables=url_variables,
|
|
818
|
+
request=None,
|
|
819
|
+
request_body_required=False,
|
|
820
|
+
request_has_path_params=False,
|
|
821
|
+
request_has_query_params=True,
|
|
822
|
+
user_agent_header="user-agent",
|
|
823
|
+
accept_header_value="application/json",
|
|
824
|
+
http_headers=http_headers,
|
|
825
|
+
security=self.sdk_configuration.security,
|
|
826
|
+
allow_empty_value=None,
|
|
827
|
+
timeout_ms=timeout_ms,
|
|
828
|
+
)
|
|
829
|
+
|
|
830
|
+
if retries == UNSET:
|
|
831
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
832
|
+
retries = self.sdk_configuration.retry_config
|
|
833
|
+
|
|
834
|
+
retry_config = None
|
|
835
|
+
if isinstance(retries, utils.RetryConfig):
|
|
836
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
837
|
+
|
|
838
|
+
http_res = await self.do_request_async(
|
|
839
|
+
hook_ctx=HookContext(
|
|
840
|
+
config=self.sdk_configuration,
|
|
841
|
+
base_url=base_url or "",
|
|
842
|
+
operation_id="get_coverage_stats",
|
|
843
|
+
oauth2_scopes=None,
|
|
844
|
+
security_source=get_security_from_env(
|
|
845
|
+
self.sdk_configuration.security, models.Security
|
|
846
|
+
),
|
|
847
|
+
),
|
|
848
|
+
request=req,
|
|
849
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
850
|
+
retry_config=retry_config,
|
|
851
|
+
)
|
|
852
|
+
|
|
853
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
854
|
+
return unmarshal_json_response(Any, http_res)
|
|
855
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
856
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
857
|
+
raise errors.PermitstackDefaultError(
|
|
858
|
+
"API error occurred", http_res, http_res_text
|
|
859
|
+
)
|
|
860
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
861
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
862
|
+
raise errors.PermitstackDefaultError(
|
|
863
|
+
"API error occurred", http_res, http_res_text
|
|
864
|
+
)
|
|
865
|
+
|
|
866
|
+
raise errors.PermitstackDefaultError("Unexpected response received", http_res)
|