tango-python 0.0.1a1__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.
- tango/__init__.py +83 -0
- tango/_base_client.py +2045 -0
- tango/_client.py +544 -0
- tango/_compat.py +219 -0
- tango/_constants.py +14 -0
- tango/_exceptions.py +108 -0
- tango/_files.py +123 -0
- tango/_models.py +788 -0
- tango/_qs.py +150 -0
- tango/_resource.py +43 -0
- tango/_response.py +824 -0
- tango/_streaming.py +333 -0
- tango/_types.py +219 -0
- tango/_utils/__init__.py +56 -0
- tango/_utils/_logs.py +25 -0
- tango/_utils/_proxy.py +62 -0
- tango/_utils/_reflection.py +42 -0
- tango/_utils/_streams.py +12 -0
- tango/_utils/_sync.py +71 -0
- tango/_utils/_transform.py +392 -0
- tango/_utils/_typing.py +120 -0
- tango/_utils/_utils.py +414 -0
- tango/_version.py +4 -0
- tango/lib/.keep +4 -0
- tango/py.typed +0 -0
- tango/resources/__init__.py +229 -0
- tango/resources/agencies.py +255 -0
- tango/resources/assistance_listings.py +214 -0
- tango/resources/bulk/__init__.py +33 -0
- tango/resources/bulk/bulk.py +102 -0
- tango/resources/bulk/entities.py +152 -0
- tango/resources/business_types.py +218 -0
- tango/resources/contracts.py +381 -0
- tango/resources/departments.py +210 -0
- tango/resources/entities.py +325 -0
- tango/resources/idvs/__init__.py +33 -0
- tango/resources/idvs/awards.py +287 -0
- tango/resources/idvs/idvs.py +413 -0
- tango/resources/naics.py +317 -0
- tango/resources/notices.py +391 -0
- tango/resources/offices.py +281 -0
- tango/resources/opportunities.py +420 -0
- tango/resources/pscs.py +210 -0
- tango/resources/schemas.py +398 -0
- tango/resources/subawards.py +313 -0
- tango/resources/versions.py +136 -0
- tango/types/__init__.py +43 -0
- tango/types/agency.py +17 -0
- tango/types/agency_list_params.py +14 -0
- tango/types/agency_list_response.py +10 -0
- tango/types/assistance_listing.py +12 -0
- tango/types/assistance_listing_list_response.py +10 -0
- tango/types/assistance_listing_retrieve_response.py +26 -0
- tango/types/bulk/__init__.py +3 -0
- tango/types/business_type.py +14 -0
- tango/types/business_type_list_response.py +10 -0
- tango/types/contract_list_params.py +78 -0
- tango/types/contract_list_response.py +55 -0
- tango/types/contract_retrieve_response.py +51 -0
- tango/types/department.py +16 -0
- tango/types/department_list_response.py +10 -0
- tango/types/entity_list_params.py +38 -0
- tango/types/entity_list_response.py +37 -0
- tango/types/entity_retrieve_response.py +116 -0
- tango/types/idv.py +102 -0
- tango/types/idv_list_params.py +78 -0
- tango/types/idv_list_response.py +27 -0
- tango/types/idvs/__init__.py +6 -0
- tango/types/idvs/award_list_params.py +55 -0
- tango/types/idvs/award_list_response.py +55 -0
- tango/types/naic_list_params.py +47 -0
- tango/types/naic_list_response.py +10 -0
- tango/types/naic_retrieve_response.py +13 -0
- tango/types/naics_code.py +13 -0
- tango/types/notice_list_params.py +81 -0
- tango/types/notice_list_response.py +60 -0
- tango/types/notice_retrieve_response.py +93 -0
- tango/types/office.py +15 -0
- tango/types/office_list_params.py +18 -0
- tango/types/office_list_response.py +18 -0
- tango/types/opportunity_list_params.py +97 -0
- tango/types/opportunity_list_response.py +101 -0
- tango/types/opportunity_retrieve_response.py +123 -0
- tango/types/product_service_code.py +21 -0
- tango/types/psc_list_response.py +10 -0
- tango/types/schema_retrieve_params.py +113 -0
- tango/types/schema_retrieve_response.py +8 -0
- tango/types/subaward.py +172 -0
- tango/types/subaward_list_params.py +33 -0
- tango/types/subaward_list_response.py +18 -0
- tango_python-0.0.1a1.dist-info/METADATA +359 -0
- tango_python-0.0.1a1.dist-info/RECORD +94 -0
- tango_python-0.0.1a1.dist-info/WHEEL +4 -0
- tango_python-0.0.1a1.dist-info/licenses/LICENSE +201 -0
tango/_client.py
ADDED
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
from typing import Any, Union, Mapping
|
|
7
|
+
from typing_extensions import Self, override
|
|
8
|
+
|
|
9
|
+
import httpx
|
|
10
|
+
|
|
11
|
+
from . import resources, _exceptions
|
|
12
|
+
from ._qs import Querystring
|
|
13
|
+
from ._types import (
|
|
14
|
+
NOT_GIVEN,
|
|
15
|
+
Omit,
|
|
16
|
+
Timeout,
|
|
17
|
+
NotGiven,
|
|
18
|
+
Transport,
|
|
19
|
+
ProxiesTypes,
|
|
20
|
+
RequestOptions,
|
|
21
|
+
)
|
|
22
|
+
from ._utils import (
|
|
23
|
+
is_given,
|
|
24
|
+
get_async_library,
|
|
25
|
+
)
|
|
26
|
+
from ._version import __version__
|
|
27
|
+
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
|
28
|
+
from ._exceptions import TangoError, APIStatusError
|
|
29
|
+
from ._base_client import (
|
|
30
|
+
DEFAULT_MAX_RETRIES,
|
|
31
|
+
SyncAPIClient,
|
|
32
|
+
AsyncAPIClient,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
__all__ = [
|
|
36
|
+
"Timeout",
|
|
37
|
+
"Transport",
|
|
38
|
+
"ProxiesTypes",
|
|
39
|
+
"RequestOptions",
|
|
40
|
+
"resources",
|
|
41
|
+
"Tango",
|
|
42
|
+
"AsyncTango",
|
|
43
|
+
"Client",
|
|
44
|
+
"AsyncClient",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class Tango(SyncAPIClient):
|
|
49
|
+
agencies: resources.AgenciesResource
|
|
50
|
+
assistance_listings: resources.AssistanceListingsResource
|
|
51
|
+
bulk: resources.BulkResource
|
|
52
|
+
business_types: resources.BusinessTypesResource
|
|
53
|
+
contracts: resources.ContractsResource
|
|
54
|
+
departments: resources.DepartmentsResource
|
|
55
|
+
entities: resources.EntitiesResource
|
|
56
|
+
idvs: resources.IdvsResource
|
|
57
|
+
naics: resources.NaicsResource
|
|
58
|
+
notices: resources.NoticesResource
|
|
59
|
+
offices: resources.OfficesResource
|
|
60
|
+
opportunities: resources.OpportunitiesResource
|
|
61
|
+
pscs: resources.PscsResource
|
|
62
|
+
schemas: resources.SchemasResource
|
|
63
|
+
subawards: resources.SubawardsResource
|
|
64
|
+
versions: resources.VersionsResource
|
|
65
|
+
with_raw_response: TangoWithRawResponse
|
|
66
|
+
with_streaming_response: TangoWithStreamedResponse
|
|
67
|
+
|
|
68
|
+
# client options
|
|
69
|
+
client_id: str
|
|
70
|
+
client_secret: str
|
|
71
|
+
|
|
72
|
+
def __init__(
|
|
73
|
+
self,
|
|
74
|
+
*,
|
|
75
|
+
client_id: str | None = None,
|
|
76
|
+
client_secret: str | None = None,
|
|
77
|
+
base_url: str | httpx.URL | None = None,
|
|
78
|
+
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
|
|
79
|
+
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
80
|
+
default_headers: Mapping[str, str] | None = None,
|
|
81
|
+
default_query: Mapping[str, object] | None = None,
|
|
82
|
+
# Configure a custom httpx client.
|
|
83
|
+
# We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`.
|
|
84
|
+
# See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details.
|
|
85
|
+
http_client: httpx.Client | None = None,
|
|
86
|
+
# Enable or disable schema validation for data returned by the API.
|
|
87
|
+
# When enabled an error APIResponseValidationError is raised
|
|
88
|
+
# if the API responds with invalid data for the expected schema.
|
|
89
|
+
#
|
|
90
|
+
# This parameter may be removed or changed in the future.
|
|
91
|
+
# If you rely on this feature, please open a GitHub issue
|
|
92
|
+
# outlining your use-case to help us decide if it should be
|
|
93
|
+
# part of our public interface in the future.
|
|
94
|
+
_strict_response_validation: bool = False,
|
|
95
|
+
) -> None:
|
|
96
|
+
"""Construct a new synchronous tango client instance.
|
|
97
|
+
|
|
98
|
+
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
|
|
99
|
+
- `client_id` from `CLIENT_ID`
|
|
100
|
+
- `client_secret` from `CLIENT_SECRET`
|
|
101
|
+
"""
|
|
102
|
+
if client_id is None:
|
|
103
|
+
client_id = os.environ.get("CLIENT_ID")
|
|
104
|
+
if client_id is None:
|
|
105
|
+
raise TangoError(
|
|
106
|
+
"The client_id client option must be set either by passing client_id to the client or by setting the CLIENT_ID environment variable"
|
|
107
|
+
)
|
|
108
|
+
self.client_id = client_id
|
|
109
|
+
|
|
110
|
+
if client_secret is None:
|
|
111
|
+
client_secret = os.environ.get("CLIENT_SECRET")
|
|
112
|
+
if client_secret is None:
|
|
113
|
+
raise TangoError(
|
|
114
|
+
"The client_secret client option must be set either by passing client_secret to the client or by setting the CLIENT_SECRET environment variable"
|
|
115
|
+
)
|
|
116
|
+
self.client_secret = client_secret
|
|
117
|
+
|
|
118
|
+
if base_url is None:
|
|
119
|
+
base_url = os.environ.get("TANGO_BASE_URL")
|
|
120
|
+
if base_url is None:
|
|
121
|
+
base_url = f"https://tango.makegov.com"
|
|
122
|
+
|
|
123
|
+
super().__init__(
|
|
124
|
+
version=__version__,
|
|
125
|
+
base_url=base_url,
|
|
126
|
+
max_retries=max_retries,
|
|
127
|
+
timeout=timeout,
|
|
128
|
+
http_client=http_client,
|
|
129
|
+
custom_headers=default_headers,
|
|
130
|
+
custom_query=default_query,
|
|
131
|
+
_strict_response_validation=_strict_response_validation,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
self.agencies = resources.AgenciesResource(self)
|
|
135
|
+
self.assistance_listings = resources.AssistanceListingsResource(self)
|
|
136
|
+
self.bulk = resources.BulkResource(self)
|
|
137
|
+
self.business_types = resources.BusinessTypesResource(self)
|
|
138
|
+
self.contracts = resources.ContractsResource(self)
|
|
139
|
+
self.departments = resources.DepartmentsResource(self)
|
|
140
|
+
self.entities = resources.EntitiesResource(self)
|
|
141
|
+
self.idvs = resources.IdvsResource(self)
|
|
142
|
+
self.naics = resources.NaicsResource(self)
|
|
143
|
+
self.notices = resources.NoticesResource(self)
|
|
144
|
+
self.offices = resources.OfficesResource(self)
|
|
145
|
+
self.opportunities = resources.OpportunitiesResource(self)
|
|
146
|
+
self.pscs = resources.PscsResource(self)
|
|
147
|
+
self.schemas = resources.SchemasResource(self)
|
|
148
|
+
self.subawards = resources.SubawardsResource(self)
|
|
149
|
+
self.versions = resources.VersionsResource(self)
|
|
150
|
+
self.with_raw_response = TangoWithRawResponse(self)
|
|
151
|
+
self.with_streaming_response = TangoWithStreamedResponse(self)
|
|
152
|
+
|
|
153
|
+
@property
|
|
154
|
+
@override
|
|
155
|
+
def qs(self) -> Querystring:
|
|
156
|
+
return Querystring(array_format="comma")
|
|
157
|
+
|
|
158
|
+
@property
|
|
159
|
+
@override
|
|
160
|
+
def default_headers(self) -> dict[str, str | Omit]:
|
|
161
|
+
return {
|
|
162
|
+
**super().default_headers,
|
|
163
|
+
"X-Stainless-Async": "false",
|
|
164
|
+
**self._custom_headers,
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
def copy(
|
|
168
|
+
self,
|
|
169
|
+
*,
|
|
170
|
+
client_id: str | None = None,
|
|
171
|
+
client_secret: str | None = None,
|
|
172
|
+
base_url: str | httpx.URL | None = None,
|
|
173
|
+
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
|
|
174
|
+
http_client: httpx.Client | None = None,
|
|
175
|
+
max_retries: int | NotGiven = NOT_GIVEN,
|
|
176
|
+
default_headers: Mapping[str, str] | None = None,
|
|
177
|
+
set_default_headers: Mapping[str, str] | None = None,
|
|
178
|
+
default_query: Mapping[str, object] | None = None,
|
|
179
|
+
set_default_query: Mapping[str, object] | None = None,
|
|
180
|
+
_extra_kwargs: Mapping[str, Any] = {},
|
|
181
|
+
) -> Self:
|
|
182
|
+
"""
|
|
183
|
+
Create a new client instance re-using the same options given to the current client with optional overriding.
|
|
184
|
+
"""
|
|
185
|
+
if default_headers is not None and set_default_headers is not None:
|
|
186
|
+
raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive")
|
|
187
|
+
|
|
188
|
+
if default_query is not None and set_default_query is not None:
|
|
189
|
+
raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive")
|
|
190
|
+
|
|
191
|
+
headers = self._custom_headers
|
|
192
|
+
if default_headers is not None:
|
|
193
|
+
headers = {**headers, **default_headers}
|
|
194
|
+
elif set_default_headers is not None:
|
|
195
|
+
headers = set_default_headers
|
|
196
|
+
|
|
197
|
+
params = self._custom_query
|
|
198
|
+
if default_query is not None:
|
|
199
|
+
params = {**params, **default_query}
|
|
200
|
+
elif set_default_query is not None:
|
|
201
|
+
params = set_default_query
|
|
202
|
+
|
|
203
|
+
http_client = http_client or self._client
|
|
204
|
+
return self.__class__(
|
|
205
|
+
client_id=client_id or self.client_id,
|
|
206
|
+
client_secret=client_secret or self.client_secret,
|
|
207
|
+
base_url=base_url or self.base_url,
|
|
208
|
+
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
|
|
209
|
+
http_client=http_client,
|
|
210
|
+
max_retries=max_retries if is_given(max_retries) else self.max_retries,
|
|
211
|
+
default_headers=headers,
|
|
212
|
+
default_query=params,
|
|
213
|
+
**_extra_kwargs,
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
# Alias for `copy` for nicer inline usage, e.g.
|
|
217
|
+
# client.with_options(timeout=10).foo.create(...)
|
|
218
|
+
with_options = copy
|
|
219
|
+
|
|
220
|
+
@override
|
|
221
|
+
def _make_status_error(
|
|
222
|
+
self,
|
|
223
|
+
err_msg: str,
|
|
224
|
+
*,
|
|
225
|
+
body: object,
|
|
226
|
+
response: httpx.Response,
|
|
227
|
+
) -> APIStatusError:
|
|
228
|
+
if response.status_code == 400:
|
|
229
|
+
return _exceptions.BadRequestError(err_msg, response=response, body=body)
|
|
230
|
+
|
|
231
|
+
if response.status_code == 401:
|
|
232
|
+
return _exceptions.AuthenticationError(err_msg, response=response, body=body)
|
|
233
|
+
|
|
234
|
+
if response.status_code == 403:
|
|
235
|
+
return _exceptions.PermissionDeniedError(err_msg, response=response, body=body)
|
|
236
|
+
|
|
237
|
+
if response.status_code == 404:
|
|
238
|
+
return _exceptions.NotFoundError(err_msg, response=response, body=body)
|
|
239
|
+
|
|
240
|
+
if response.status_code == 409:
|
|
241
|
+
return _exceptions.ConflictError(err_msg, response=response, body=body)
|
|
242
|
+
|
|
243
|
+
if response.status_code == 422:
|
|
244
|
+
return _exceptions.UnprocessableEntityError(err_msg, response=response, body=body)
|
|
245
|
+
|
|
246
|
+
if response.status_code == 429:
|
|
247
|
+
return _exceptions.RateLimitError(err_msg, response=response, body=body)
|
|
248
|
+
|
|
249
|
+
if response.status_code >= 500:
|
|
250
|
+
return _exceptions.InternalServerError(err_msg, response=response, body=body)
|
|
251
|
+
return APIStatusError(err_msg, response=response, body=body)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
class AsyncTango(AsyncAPIClient):
|
|
255
|
+
agencies: resources.AsyncAgenciesResource
|
|
256
|
+
assistance_listings: resources.AsyncAssistanceListingsResource
|
|
257
|
+
bulk: resources.AsyncBulkResource
|
|
258
|
+
business_types: resources.AsyncBusinessTypesResource
|
|
259
|
+
contracts: resources.AsyncContractsResource
|
|
260
|
+
departments: resources.AsyncDepartmentsResource
|
|
261
|
+
entities: resources.AsyncEntitiesResource
|
|
262
|
+
idvs: resources.AsyncIdvsResource
|
|
263
|
+
naics: resources.AsyncNaicsResource
|
|
264
|
+
notices: resources.AsyncNoticesResource
|
|
265
|
+
offices: resources.AsyncOfficesResource
|
|
266
|
+
opportunities: resources.AsyncOpportunitiesResource
|
|
267
|
+
pscs: resources.AsyncPscsResource
|
|
268
|
+
schemas: resources.AsyncSchemasResource
|
|
269
|
+
subawards: resources.AsyncSubawardsResource
|
|
270
|
+
versions: resources.AsyncVersionsResource
|
|
271
|
+
with_raw_response: AsyncTangoWithRawResponse
|
|
272
|
+
with_streaming_response: AsyncTangoWithStreamedResponse
|
|
273
|
+
|
|
274
|
+
# client options
|
|
275
|
+
client_id: str
|
|
276
|
+
client_secret: str
|
|
277
|
+
|
|
278
|
+
def __init__(
|
|
279
|
+
self,
|
|
280
|
+
*,
|
|
281
|
+
client_id: str | None = None,
|
|
282
|
+
client_secret: str | None = None,
|
|
283
|
+
base_url: str | httpx.URL | None = None,
|
|
284
|
+
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
|
|
285
|
+
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
286
|
+
default_headers: Mapping[str, str] | None = None,
|
|
287
|
+
default_query: Mapping[str, object] | None = None,
|
|
288
|
+
# Configure a custom httpx client.
|
|
289
|
+
# We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`.
|
|
290
|
+
# See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details.
|
|
291
|
+
http_client: httpx.AsyncClient | None = None,
|
|
292
|
+
# Enable or disable schema validation for data returned by the API.
|
|
293
|
+
# When enabled an error APIResponseValidationError is raised
|
|
294
|
+
# if the API responds with invalid data for the expected schema.
|
|
295
|
+
#
|
|
296
|
+
# This parameter may be removed or changed in the future.
|
|
297
|
+
# If you rely on this feature, please open a GitHub issue
|
|
298
|
+
# outlining your use-case to help us decide if it should be
|
|
299
|
+
# part of our public interface in the future.
|
|
300
|
+
_strict_response_validation: bool = False,
|
|
301
|
+
) -> None:
|
|
302
|
+
"""Construct a new async tango client instance.
|
|
303
|
+
|
|
304
|
+
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
|
|
305
|
+
- `client_id` from `CLIENT_ID`
|
|
306
|
+
- `client_secret` from `CLIENT_SECRET`
|
|
307
|
+
"""
|
|
308
|
+
if client_id is None:
|
|
309
|
+
client_id = os.environ.get("CLIENT_ID")
|
|
310
|
+
if client_id is None:
|
|
311
|
+
raise TangoError(
|
|
312
|
+
"The client_id client option must be set either by passing client_id to the client or by setting the CLIENT_ID environment variable"
|
|
313
|
+
)
|
|
314
|
+
self.client_id = client_id
|
|
315
|
+
|
|
316
|
+
if client_secret is None:
|
|
317
|
+
client_secret = os.environ.get("CLIENT_SECRET")
|
|
318
|
+
if client_secret is None:
|
|
319
|
+
raise TangoError(
|
|
320
|
+
"The client_secret client option must be set either by passing client_secret to the client or by setting the CLIENT_SECRET environment variable"
|
|
321
|
+
)
|
|
322
|
+
self.client_secret = client_secret
|
|
323
|
+
|
|
324
|
+
if base_url is None:
|
|
325
|
+
base_url = os.environ.get("TANGO_BASE_URL")
|
|
326
|
+
if base_url is None:
|
|
327
|
+
base_url = f"https://tango.makegov.com"
|
|
328
|
+
|
|
329
|
+
super().__init__(
|
|
330
|
+
version=__version__,
|
|
331
|
+
base_url=base_url,
|
|
332
|
+
max_retries=max_retries,
|
|
333
|
+
timeout=timeout,
|
|
334
|
+
http_client=http_client,
|
|
335
|
+
custom_headers=default_headers,
|
|
336
|
+
custom_query=default_query,
|
|
337
|
+
_strict_response_validation=_strict_response_validation,
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
self.agencies = resources.AsyncAgenciesResource(self)
|
|
341
|
+
self.assistance_listings = resources.AsyncAssistanceListingsResource(self)
|
|
342
|
+
self.bulk = resources.AsyncBulkResource(self)
|
|
343
|
+
self.business_types = resources.AsyncBusinessTypesResource(self)
|
|
344
|
+
self.contracts = resources.AsyncContractsResource(self)
|
|
345
|
+
self.departments = resources.AsyncDepartmentsResource(self)
|
|
346
|
+
self.entities = resources.AsyncEntitiesResource(self)
|
|
347
|
+
self.idvs = resources.AsyncIdvsResource(self)
|
|
348
|
+
self.naics = resources.AsyncNaicsResource(self)
|
|
349
|
+
self.notices = resources.AsyncNoticesResource(self)
|
|
350
|
+
self.offices = resources.AsyncOfficesResource(self)
|
|
351
|
+
self.opportunities = resources.AsyncOpportunitiesResource(self)
|
|
352
|
+
self.pscs = resources.AsyncPscsResource(self)
|
|
353
|
+
self.schemas = resources.AsyncSchemasResource(self)
|
|
354
|
+
self.subawards = resources.AsyncSubawardsResource(self)
|
|
355
|
+
self.versions = resources.AsyncVersionsResource(self)
|
|
356
|
+
self.with_raw_response = AsyncTangoWithRawResponse(self)
|
|
357
|
+
self.with_streaming_response = AsyncTangoWithStreamedResponse(self)
|
|
358
|
+
|
|
359
|
+
@property
|
|
360
|
+
@override
|
|
361
|
+
def qs(self) -> Querystring:
|
|
362
|
+
return Querystring(array_format="comma")
|
|
363
|
+
|
|
364
|
+
@property
|
|
365
|
+
@override
|
|
366
|
+
def default_headers(self) -> dict[str, str | Omit]:
|
|
367
|
+
return {
|
|
368
|
+
**super().default_headers,
|
|
369
|
+
"X-Stainless-Async": f"async:{get_async_library()}",
|
|
370
|
+
**self._custom_headers,
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
def copy(
|
|
374
|
+
self,
|
|
375
|
+
*,
|
|
376
|
+
client_id: str | None = None,
|
|
377
|
+
client_secret: str | None = None,
|
|
378
|
+
base_url: str | httpx.URL | None = None,
|
|
379
|
+
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
|
|
380
|
+
http_client: httpx.AsyncClient | None = None,
|
|
381
|
+
max_retries: int | NotGiven = NOT_GIVEN,
|
|
382
|
+
default_headers: Mapping[str, str] | None = None,
|
|
383
|
+
set_default_headers: Mapping[str, str] | None = None,
|
|
384
|
+
default_query: Mapping[str, object] | None = None,
|
|
385
|
+
set_default_query: Mapping[str, object] | None = None,
|
|
386
|
+
_extra_kwargs: Mapping[str, Any] = {},
|
|
387
|
+
) -> Self:
|
|
388
|
+
"""
|
|
389
|
+
Create a new client instance re-using the same options given to the current client with optional overriding.
|
|
390
|
+
"""
|
|
391
|
+
if default_headers is not None and set_default_headers is not None:
|
|
392
|
+
raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive")
|
|
393
|
+
|
|
394
|
+
if default_query is not None and set_default_query is not None:
|
|
395
|
+
raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive")
|
|
396
|
+
|
|
397
|
+
headers = self._custom_headers
|
|
398
|
+
if default_headers is not None:
|
|
399
|
+
headers = {**headers, **default_headers}
|
|
400
|
+
elif set_default_headers is not None:
|
|
401
|
+
headers = set_default_headers
|
|
402
|
+
|
|
403
|
+
params = self._custom_query
|
|
404
|
+
if default_query is not None:
|
|
405
|
+
params = {**params, **default_query}
|
|
406
|
+
elif set_default_query is not None:
|
|
407
|
+
params = set_default_query
|
|
408
|
+
|
|
409
|
+
http_client = http_client or self._client
|
|
410
|
+
return self.__class__(
|
|
411
|
+
client_id=client_id or self.client_id,
|
|
412
|
+
client_secret=client_secret or self.client_secret,
|
|
413
|
+
base_url=base_url or self.base_url,
|
|
414
|
+
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
|
|
415
|
+
http_client=http_client,
|
|
416
|
+
max_retries=max_retries if is_given(max_retries) else self.max_retries,
|
|
417
|
+
default_headers=headers,
|
|
418
|
+
default_query=params,
|
|
419
|
+
**_extra_kwargs,
|
|
420
|
+
)
|
|
421
|
+
|
|
422
|
+
# Alias for `copy` for nicer inline usage, e.g.
|
|
423
|
+
# client.with_options(timeout=10).foo.create(...)
|
|
424
|
+
with_options = copy
|
|
425
|
+
|
|
426
|
+
@override
|
|
427
|
+
def _make_status_error(
|
|
428
|
+
self,
|
|
429
|
+
err_msg: str,
|
|
430
|
+
*,
|
|
431
|
+
body: object,
|
|
432
|
+
response: httpx.Response,
|
|
433
|
+
) -> APIStatusError:
|
|
434
|
+
if response.status_code == 400:
|
|
435
|
+
return _exceptions.BadRequestError(err_msg, response=response, body=body)
|
|
436
|
+
|
|
437
|
+
if response.status_code == 401:
|
|
438
|
+
return _exceptions.AuthenticationError(err_msg, response=response, body=body)
|
|
439
|
+
|
|
440
|
+
if response.status_code == 403:
|
|
441
|
+
return _exceptions.PermissionDeniedError(err_msg, response=response, body=body)
|
|
442
|
+
|
|
443
|
+
if response.status_code == 404:
|
|
444
|
+
return _exceptions.NotFoundError(err_msg, response=response, body=body)
|
|
445
|
+
|
|
446
|
+
if response.status_code == 409:
|
|
447
|
+
return _exceptions.ConflictError(err_msg, response=response, body=body)
|
|
448
|
+
|
|
449
|
+
if response.status_code == 422:
|
|
450
|
+
return _exceptions.UnprocessableEntityError(err_msg, response=response, body=body)
|
|
451
|
+
|
|
452
|
+
if response.status_code == 429:
|
|
453
|
+
return _exceptions.RateLimitError(err_msg, response=response, body=body)
|
|
454
|
+
|
|
455
|
+
if response.status_code >= 500:
|
|
456
|
+
return _exceptions.InternalServerError(err_msg, response=response, body=body)
|
|
457
|
+
return APIStatusError(err_msg, response=response, body=body)
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
class TangoWithRawResponse:
|
|
461
|
+
def __init__(self, client: Tango) -> None:
|
|
462
|
+
self.agencies = resources.AgenciesResourceWithRawResponse(client.agencies)
|
|
463
|
+
self.assistance_listings = resources.AssistanceListingsResourceWithRawResponse(client.assistance_listings)
|
|
464
|
+
self.bulk = resources.BulkResourceWithRawResponse(client.bulk)
|
|
465
|
+
self.business_types = resources.BusinessTypesResourceWithRawResponse(client.business_types)
|
|
466
|
+
self.contracts = resources.ContractsResourceWithRawResponse(client.contracts)
|
|
467
|
+
self.departments = resources.DepartmentsResourceWithRawResponse(client.departments)
|
|
468
|
+
self.entities = resources.EntitiesResourceWithRawResponse(client.entities)
|
|
469
|
+
self.idvs = resources.IdvsResourceWithRawResponse(client.idvs)
|
|
470
|
+
self.naics = resources.NaicsResourceWithRawResponse(client.naics)
|
|
471
|
+
self.notices = resources.NoticesResourceWithRawResponse(client.notices)
|
|
472
|
+
self.offices = resources.OfficesResourceWithRawResponse(client.offices)
|
|
473
|
+
self.opportunities = resources.OpportunitiesResourceWithRawResponse(client.opportunities)
|
|
474
|
+
self.pscs = resources.PscsResourceWithRawResponse(client.pscs)
|
|
475
|
+
self.schemas = resources.SchemasResourceWithRawResponse(client.schemas)
|
|
476
|
+
self.subawards = resources.SubawardsResourceWithRawResponse(client.subawards)
|
|
477
|
+
self.versions = resources.VersionsResourceWithRawResponse(client.versions)
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
class AsyncTangoWithRawResponse:
|
|
481
|
+
def __init__(self, client: AsyncTango) -> None:
|
|
482
|
+
self.agencies = resources.AsyncAgenciesResourceWithRawResponse(client.agencies)
|
|
483
|
+
self.assistance_listings = resources.AsyncAssistanceListingsResourceWithRawResponse(client.assistance_listings)
|
|
484
|
+
self.bulk = resources.AsyncBulkResourceWithRawResponse(client.bulk)
|
|
485
|
+
self.business_types = resources.AsyncBusinessTypesResourceWithRawResponse(client.business_types)
|
|
486
|
+
self.contracts = resources.AsyncContractsResourceWithRawResponse(client.contracts)
|
|
487
|
+
self.departments = resources.AsyncDepartmentsResourceWithRawResponse(client.departments)
|
|
488
|
+
self.entities = resources.AsyncEntitiesResourceWithRawResponse(client.entities)
|
|
489
|
+
self.idvs = resources.AsyncIdvsResourceWithRawResponse(client.idvs)
|
|
490
|
+
self.naics = resources.AsyncNaicsResourceWithRawResponse(client.naics)
|
|
491
|
+
self.notices = resources.AsyncNoticesResourceWithRawResponse(client.notices)
|
|
492
|
+
self.offices = resources.AsyncOfficesResourceWithRawResponse(client.offices)
|
|
493
|
+
self.opportunities = resources.AsyncOpportunitiesResourceWithRawResponse(client.opportunities)
|
|
494
|
+
self.pscs = resources.AsyncPscsResourceWithRawResponse(client.pscs)
|
|
495
|
+
self.schemas = resources.AsyncSchemasResourceWithRawResponse(client.schemas)
|
|
496
|
+
self.subawards = resources.AsyncSubawardsResourceWithRawResponse(client.subawards)
|
|
497
|
+
self.versions = resources.AsyncVersionsResourceWithRawResponse(client.versions)
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
class TangoWithStreamedResponse:
|
|
501
|
+
def __init__(self, client: Tango) -> None:
|
|
502
|
+
self.agencies = resources.AgenciesResourceWithStreamingResponse(client.agencies)
|
|
503
|
+
self.assistance_listings = resources.AssistanceListingsResourceWithStreamingResponse(client.assistance_listings)
|
|
504
|
+
self.bulk = resources.BulkResourceWithStreamingResponse(client.bulk)
|
|
505
|
+
self.business_types = resources.BusinessTypesResourceWithStreamingResponse(client.business_types)
|
|
506
|
+
self.contracts = resources.ContractsResourceWithStreamingResponse(client.contracts)
|
|
507
|
+
self.departments = resources.DepartmentsResourceWithStreamingResponse(client.departments)
|
|
508
|
+
self.entities = resources.EntitiesResourceWithStreamingResponse(client.entities)
|
|
509
|
+
self.idvs = resources.IdvsResourceWithStreamingResponse(client.idvs)
|
|
510
|
+
self.naics = resources.NaicsResourceWithStreamingResponse(client.naics)
|
|
511
|
+
self.notices = resources.NoticesResourceWithStreamingResponse(client.notices)
|
|
512
|
+
self.offices = resources.OfficesResourceWithStreamingResponse(client.offices)
|
|
513
|
+
self.opportunities = resources.OpportunitiesResourceWithStreamingResponse(client.opportunities)
|
|
514
|
+
self.pscs = resources.PscsResourceWithStreamingResponse(client.pscs)
|
|
515
|
+
self.schemas = resources.SchemasResourceWithStreamingResponse(client.schemas)
|
|
516
|
+
self.subawards = resources.SubawardsResourceWithStreamingResponse(client.subawards)
|
|
517
|
+
self.versions = resources.VersionsResourceWithStreamingResponse(client.versions)
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
class AsyncTangoWithStreamedResponse:
|
|
521
|
+
def __init__(self, client: AsyncTango) -> None:
|
|
522
|
+
self.agencies = resources.AsyncAgenciesResourceWithStreamingResponse(client.agencies)
|
|
523
|
+
self.assistance_listings = resources.AsyncAssistanceListingsResourceWithStreamingResponse(
|
|
524
|
+
client.assistance_listings
|
|
525
|
+
)
|
|
526
|
+
self.bulk = resources.AsyncBulkResourceWithStreamingResponse(client.bulk)
|
|
527
|
+
self.business_types = resources.AsyncBusinessTypesResourceWithStreamingResponse(client.business_types)
|
|
528
|
+
self.contracts = resources.AsyncContractsResourceWithStreamingResponse(client.contracts)
|
|
529
|
+
self.departments = resources.AsyncDepartmentsResourceWithStreamingResponse(client.departments)
|
|
530
|
+
self.entities = resources.AsyncEntitiesResourceWithStreamingResponse(client.entities)
|
|
531
|
+
self.idvs = resources.AsyncIdvsResourceWithStreamingResponse(client.idvs)
|
|
532
|
+
self.naics = resources.AsyncNaicsResourceWithStreamingResponse(client.naics)
|
|
533
|
+
self.notices = resources.AsyncNoticesResourceWithStreamingResponse(client.notices)
|
|
534
|
+
self.offices = resources.AsyncOfficesResourceWithStreamingResponse(client.offices)
|
|
535
|
+
self.opportunities = resources.AsyncOpportunitiesResourceWithStreamingResponse(client.opportunities)
|
|
536
|
+
self.pscs = resources.AsyncPscsResourceWithStreamingResponse(client.pscs)
|
|
537
|
+
self.schemas = resources.AsyncSchemasResourceWithStreamingResponse(client.schemas)
|
|
538
|
+
self.subawards = resources.AsyncSubawardsResourceWithStreamingResponse(client.subawards)
|
|
539
|
+
self.versions = resources.AsyncVersionsResourceWithStreamingResponse(client.versions)
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
Client = Tango
|
|
543
|
+
|
|
544
|
+
AsyncClient = AsyncTango
|