fal 0.12.1__py3-none-any.whl → 0.12.3__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.
Potentially problematic release.
This version of fal might be problematic. Click here for more details.
- fal/__init__.py +12 -3
- fal/_serialization.py +18 -0
- fal/api.py +140 -59
- fal/app.py +309 -86
- fal/apps.py +92 -8
- fal/auth/__init__.py +20 -1
- fal/auth/auth0.py +32 -22
- fal/cli.py +34 -52
- fal/env.py +0 -4
- fal/exceptions/handlers.py +3 -2
- fal/flags.py +5 -0
- fal/logging/__init__.py +0 -2
- fal/logging/trace.py +8 -1
- fal/logging/user.py +2 -1
- fal/rest_client.py +2 -2
- fal/sdk.py +46 -31
- fal/sync.py +3 -3
- fal/toolkit/__init__.py +18 -1
- fal/toolkit/file/file.py +98 -11
- fal/toolkit/file/providers/fal.py +43 -2
- fal/toolkit/file/types.py +1 -1
- fal/toolkit/image/image.py +26 -4
- fal/toolkit/optimize.py +50 -0
- fal/toolkit/utils/download_utils.py +59 -13
- {fal-0.12.1.dist-info → fal-0.12.3.dist-info}/METADATA +7 -7
- fal-0.12.3.dist-info/RECORD +66 -0
- openapi_fal_rest/models/__init__.py +2 -70
- openapi_fal_rest/models/customer_details.py +26 -0
- openapi_fal_rest/models/lock_reason.py +16 -0
- fal/logging/datadog.py +0 -77
- fal-0.12.1.dist-info/RECORD +0 -147
- openapi_fal_rest/api/admin/get_invoice_users.py +0 -142
- openapi_fal_rest/api/admin/get_usage_per_user.py +0 -199
- openapi_fal_rest/api/admin/handle_user_lock.py +0 -191
- openapi_fal_rest/api/admin/set_billing_type.py +0 -186
- openapi_fal_rest/api/applications/get_status_applications_app_user_id_app_alias_or_id_status_get.py +0 -179
- openapi_fal_rest/api/billing/delete_payment_method.py +0 -162
- openapi_fal_rest/api/billing/get_checkout_page.py +0 -198
- openapi_fal_rest/api/billing/get_setup_intent_key.py +0 -141
- openapi_fal_rest/api/billing/get_user_invoices.py +0 -152
- openapi_fal_rest/api/billing/get_user_payment_methods.py +0 -152
- openapi_fal_rest/api/billing/get_user_price.py +0 -186
- openapi_fal_rest/api/billing/get_user_spending.py +0 -192
- openapi_fal_rest/api/billing/handle_stripe_webhook.py +0 -173
- openapi_fal_rest/api/billing/upcoming_invoice.py +0 -143
- openapi_fal_rest/api/billing/update_customer_budget.py +0 -183
- openapi_fal_rest/api/files/delete.py +0 -162
- openapi_fal_rest/api/files/download.py +0 -162
- openapi_fal_rest/api/files/file_exists.py +0 -183
- openapi_fal_rest/api/files/list_directory.py +0 -173
- openapi_fal_rest/api/files/list_root.py +0 -152
- openapi_fal_rest/api/files/upload_from_url.py +0 -179
- openapi_fal_rest/api/health/__init__.py +0 -0
- openapi_fal_rest/api/health/check.py +0 -136
- openapi_fal_rest/api/keys/__init__.py +0 -0
- openapi_fal_rest/api/keys/create_key.py +0 -188
- openapi_fal_rest/api/keys/delete_key.py +0 -162
- openapi_fal_rest/api/keys/list_keys.py +0 -152
- openapi_fal_rest/api/logs/__init__.py +0 -0
- openapi_fal_rest/api/logs/list_since.py +0 -224
- openapi_fal_rest/api/requests/__init__.py +0 -0
- openapi_fal_rest/api/requests/requests.py +0 -247
- openapi_fal_rest/api/storage/__init__.py +0 -0
- openapi_fal_rest/api/storage/get_file_link.py +0 -200
- openapi_fal_rest/api/storage/initiate_upload.py +0 -172
- openapi_fal_rest/api/storage/upload_file.py +0 -172
- openapi_fal_rest/api/tokens/__init__.py +0 -0
- openapi_fal_rest/api/tokens/create_token.py +0 -166
- openapi_fal_rest/api/usage/__init__.py +0 -0
- openapi_fal_rest/api/usage/get_custom_usage_per_machine.py +0 -203
- openapi_fal_rest/api/usage/get_gateway_request_stats.py +0 -247
- openapi_fal_rest/api/usage/get_gateway_request_stats_by_time.py +0 -236
- openapi_fal_rest/api/usage/get_gateway_stats_for_yesterday.py +0 -152
- openapi_fal_rest/api/usage/get_shared_usage_per_app.py +0 -203
- openapi_fal_rest/api/usage/get_usage_records.py +0 -253
- openapi_fal_rest/api/usage/per_machine_usage.py +0 -218
- openapi_fal_rest/api/usage/per_machine_usage_details.py +0 -173
- openapi_fal_rest/api/users/__init__.py +0 -0
- openapi_fal_rest/api/users/handle_user_registration.py +0 -228
- openapi_fal_rest/models/billing_type.py +0 -9
- openapi_fal_rest/models/body_create_token.py +0 -68
- openapi_fal_rest/models/body_upload_file.py +0 -75
- openapi_fal_rest/models/file_spec.py +0 -110
- openapi_fal_rest/models/gateway_stats_by_time.py +0 -115
- openapi_fal_rest/models/gateway_usage_stats.py +0 -147
- openapi_fal_rest/models/get_gateway_request_stats_by_time_response_get_gateway_request_stats_by_time.py +0 -70
- openapi_fal_rest/models/grouped_usage_detail.py +0 -85
- openapi_fal_rest/models/handle_stripe_webhook_response_handle_stripe_webhook.py +0 -43
- openapi_fal_rest/models/initiate_upload_info.py +0 -64
- openapi_fal_rest/models/invoice.py +0 -129
- openapi_fal_rest/models/invoice_item.py +0 -85
- openapi_fal_rest/models/key_scope.py +0 -9
- openapi_fal_rest/models/log_entry.py +0 -104
- openapi_fal_rest/models/log_entry_labels.py +0 -43
- openapi_fal_rest/models/new_user_key.py +0 -64
- openapi_fal_rest/models/payment_method.py +0 -96
- openapi_fal_rest/models/per_app_usage_detail.py +0 -88
- openapi_fal_rest/models/persisted_usage_record.py +0 -118
- openapi_fal_rest/models/persisted_usage_record_meta.py +0 -43
- openapi_fal_rest/models/presigned_upload_url.py +0 -64
- openapi_fal_rest/models/request_io.py +0 -112
- openapi_fal_rest/models/request_io_json_input.py +0 -43
- openapi_fal_rest/models/request_io_json_output.py +0 -43
- openapi_fal_rest/models/run_type.py +0 -9
- openapi_fal_rest/models/stats_timeframe.py +0 -12
- openapi_fal_rest/models/status.py +0 -82
- openapi_fal_rest/models/status_health.py +0 -10
- openapi_fal_rest/models/uploaded_file_result.py +0 -64
- openapi_fal_rest/models/url_file_upload.py +0 -57
- openapi_fal_rest/models/usage_per_machine_type.py +0 -115
- openapi_fal_rest/models/usage_per_user.py +0 -71
- openapi_fal_rest/models/usage_run_detail.py +0 -73
- openapi_fal_rest/models/user_key_info.py +0 -84
- /openapi_fal_rest/api/admin/__init__.py → /fal/py.typed +0 -0
- {fal-0.12.1.dist-info → fal-0.12.3.dist-info}/WHEEL +0 -0
- {fal-0.12.1.dist-info → fal-0.12.3.dist-info}/entry_points.txt +0 -0
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
from http import HTTPStatus
|
|
2
|
-
from typing import Any, Dict, Optional, Union, cast
|
|
3
|
-
|
|
4
|
-
import httpx
|
|
5
|
-
|
|
6
|
-
from ... import errors
|
|
7
|
-
from ...client import Client
|
|
8
|
-
from ...models.http_validation_error import HTTPValidationError
|
|
9
|
-
from ...models.url_file_upload import UrlFileUpload
|
|
10
|
-
from ...types import Response
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def _get_kwargs(
|
|
14
|
-
file: str,
|
|
15
|
-
*,
|
|
16
|
-
client: Client,
|
|
17
|
-
json_body: UrlFileUpload,
|
|
18
|
-
) -> Dict[str, Any]:
|
|
19
|
-
url = "{}/files/file/url/{file}".format(client.base_url, file=file)
|
|
20
|
-
|
|
21
|
-
headers: Dict[str, str] = client.get_headers()
|
|
22
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
23
|
-
|
|
24
|
-
json_json_body = json_body.to_dict()
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
"method": "post",
|
|
28
|
-
"url": url,
|
|
29
|
-
"headers": headers,
|
|
30
|
-
"cookies": cookies,
|
|
31
|
-
"timeout": client.get_timeout(),
|
|
32
|
-
"follow_redirects": client.follow_redirects,
|
|
33
|
-
"json": json_json_body,
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[HTTPValidationError, bool]]:
|
|
38
|
-
if response.status_code == HTTPStatus.OK:
|
|
39
|
-
response_200 = cast(bool, response.json())
|
|
40
|
-
return response_200
|
|
41
|
-
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
|
42
|
-
response_422 = HTTPValidationError.from_dict(response.json())
|
|
43
|
-
|
|
44
|
-
return response_422
|
|
45
|
-
if client.raise_on_unexpected_status:
|
|
46
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
47
|
-
else:
|
|
48
|
-
return None
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[HTTPValidationError, bool]]:
|
|
52
|
-
return Response(
|
|
53
|
-
status_code=HTTPStatus(response.status_code),
|
|
54
|
-
content=response.content,
|
|
55
|
-
headers=response.headers,
|
|
56
|
-
parsed=_parse_response(client=client, response=response),
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
def sync_detailed(
|
|
61
|
-
file: str,
|
|
62
|
-
*,
|
|
63
|
-
client: Client,
|
|
64
|
-
json_body: UrlFileUpload,
|
|
65
|
-
) -> Response[Union[HTTPValidationError, bool]]:
|
|
66
|
-
"""Upload Url File
|
|
67
|
-
|
|
68
|
-
Args:
|
|
69
|
-
file (str):
|
|
70
|
-
json_body (UrlFileUpload):
|
|
71
|
-
|
|
72
|
-
Raises:
|
|
73
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
74
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
75
|
-
|
|
76
|
-
Returns:
|
|
77
|
-
Response[Union[HTTPValidationError, bool]]
|
|
78
|
-
"""
|
|
79
|
-
|
|
80
|
-
kwargs = _get_kwargs(
|
|
81
|
-
file=file,
|
|
82
|
-
client=client,
|
|
83
|
-
json_body=json_body,
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
response = httpx.request(
|
|
87
|
-
verify=client.verify_ssl,
|
|
88
|
-
**kwargs,
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
return _build_response(client=client, response=response)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
def sync(
|
|
95
|
-
file: str,
|
|
96
|
-
*,
|
|
97
|
-
client: Client,
|
|
98
|
-
json_body: UrlFileUpload,
|
|
99
|
-
) -> Optional[Union[HTTPValidationError, bool]]:
|
|
100
|
-
"""Upload Url File
|
|
101
|
-
|
|
102
|
-
Args:
|
|
103
|
-
file (str):
|
|
104
|
-
json_body (UrlFileUpload):
|
|
105
|
-
|
|
106
|
-
Raises:
|
|
107
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
108
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
109
|
-
|
|
110
|
-
Returns:
|
|
111
|
-
Union[HTTPValidationError, bool]
|
|
112
|
-
"""
|
|
113
|
-
|
|
114
|
-
return sync_detailed(
|
|
115
|
-
file=file,
|
|
116
|
-
client=client,
|
|
117
|
-
json_body=json_body,
|
|
118
|
-
).parsed
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
async def asyncio_detailed(
|
|
122
|
-
file: str,
|
|
123
|
-
*,
|
|
124
|
-
client: Client,
|
|
125
|
-
json_body: UrlFileUpload,
|
|
126
|
-
) -> Response[Union[HTTPValidationError, bool]]:
|
|
127
|
-
"""Upload Url File
|
|
128
|
-
|
|
129
|
-
Args:
|
|
130
|
-
file (str):
|
|
131
|
-
json_body (UrlFileUpload):
|
|
132
|
-
|
|
133
|
-
Raises:
|
|
134
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
135
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
136
|
-
|
|
137
|
-
Returns:
|
|
138
|
-
Response[Union[HTTPValidationError, bool]]
|
|
139
|
-
"""
|
|
140
|
-
|
|
141
|
-
kwargs = _get_kwargs(
|
|
142
|
-
file=file,
|
|
143
|
-
client=client,
|
|
144
|
-
json_body=json_body,
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
148
|
-
response = await _client.request(**kwargs)
|
|
149
|
-
|
|
150
|
-
return _build_response(client=client, response=response)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
async def asyncio(
|
|
154
|
-
file: str,
|
|
155
|
-
*,
|
|
156
|
-
client: Client,
|
|
157
|
-
json_body: UrlFileUpload,
|
|
158
|
-
) -> Optional[Union[HTTPValidationError, bool]]:
|
|
159
|
-
"""Upload Url File
|
|
160
|
-
|
|
161
|
-
Args:
|
|
162
|
-
file (str):
|
|
163
|
-
json_body (UrlFileUpload):
|
|
164
|
-
|
|
165
|
-
Raises:
|
|
166
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
167
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
168
|
-
|
|
169
|
-
Returns:
|
|
170
|
-
Union[HTTPValidationError, bool]
|
|
171
|
-
"""
|
|
172
|
-
|
|
173
|
-
return (
|
|
174
|
-
await asyncio_detailed(
|
|
175
|
-
file=file,
|
|
176
|
-
client=client,
|
|
177
|
-
json_body=json_body,
|
|
178
|
-
)
|
|
179
|
-
).parsed
|
|
File without changes
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
from http import HTTPStatus
|
|
2
|
-
from typing import Any, Dict, Optional, cast
|
|
3
|
-
|
|
4
|
-
import httpx
|
|
5
|
-
|
|
6
|
-
from ... import errors
|
|
7
|
-
from ...client import Client
|
|
8
|
-
from ...types import Response
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def _get_kwargs(
|
|
12
|
-
*,
|
|
13
|
-
client: Client,
|
|
14
|
-
) -> Dict[str, Any]:
|
|
15
|
-
url = "{}/health/".format(client.base_url)
|
|
16
|
-
|
|
17
|
-
headers: Dict[str, str] = client.get_headers()
|
|
18
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
"method": "get",
|
|
22
|
-
"url": url,
|
|
23
|
-
"headers": headers,
|
|
24
|
-
"cookies": cookies,
|
|
25
|
-
"timeout": client.get_timeout(),
|
|
26
|
-
"follow_redirects": client.follow_redirects,
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[str]:
|
|
31
|
-
if response.status_code == HTTPStatus.OK:
|
|
32
|
-
response_200 = cast(str, response.json())
|
|
33
|
-
return response_200
|
|
34
|
-
if client.raise_on_unexpected_status:
|
|
35
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
36
|
-
else:
|
|
37
|
-
return None
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def _build_response(*, client: Client, response: httpx.Response) -> Response[str]:
|
|
41
|
-
return Response(
|
|
42
|
-
status_code=HTTPStatus(response.status_code),
|
|
43
|
-
content=response.content,
|
|
44
|
-
headers=response.headers,
|
|
45
|
-
parsed=_parse_response(client=client, response=response),
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def sync_detailed(
|
|
50
|
-
*,
|
|
51
|
-
client: Client,
|
|
52
|
-
) -> Response[str]:
|
|
53
|
-
"""Check
|
|
54
|
-
|
|
55
|
-
Raises:
|
|
56
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
57
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
58
|
-
|
|
59
|
-
Returns:
|
|
60
|
-
Response[str]
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
kwargs = _get_kwargs(
|
|
64
|
-
client=client,
|
|
65
|
-
)
|
|
66
|
-
|
|
67
|
-
response = httpx.request(
|
|
68
|
-
verify=client.verify_ssl,
|
|
69
|
-
**kwargs,
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
return _build_response(client=client, response=response)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def sync(
|
|
76
|
-
*,
|
|
77
|
-
client: Client,
|
|
78
|
-
) -> Optional[str]:
|
|
79
|
-
"""Check
|
|
80
|
-
|
|
81
|
-
Raises:
|
|
82
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
83
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
84
|
-
|
|
85
|
-
Returns:
|
|
86
|
-
str
|
|
87
|
-
"""
|
|
88
|
-
|
|
89
|
-
return sync_detailed(
|
|
90
|
-
client=client,
|
|
91
|
-
).parsed
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
async def asyncio_detailed(
|
|
95
|
-
*,
|
|
96
|
-
client: Client,
|
|
97
|
-
) -> Response[str]:
|
|
98
|
-
"""Check
|
|
99
|
-
|
|
100
|
-
Raises:
|
|
101
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
102
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
103
|
-
|
|
104
|
-
Returns:
|
|
105
|
-
Response[str]
|
|
106
|
-
"""
|
|
107
|
-
|
|
108
|
-
kwargs = _get_kwargs(
|
|
109
|
-
client=client,
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
113
|
-
response = await _client.request(**kwargs)
|
|
114
|
-
|
|
115
|
-
return _build_response(client=client, response=response)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
async def asyncio(
|
|
119
|
-
*,
|
|
120
|
-
client: Client,
|
|
121
|
-
) -> Optional[str]:
|
|
122
|
-
"""Check
|
|
123
|
-
|
|
124
|
-
Raises:
|
|
125
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
126
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
127
|
-
|
|
128
|
-
Returns:
|
|
129
|
-
str
|
|
130
|
-
"""
|
|
131
|
-
|
|
132
|
-
return (
|
|
133
|
-
await asyncio_detailed(
|
|
134
|
-
client=client,
|
|
135
|
-
)
|
|
136
|
-
).parsed
|
|
File without changes
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
from http import HTTPStatus
|
|
2
|
-
from typing import Any, Dict, Optional, Union
|
|
3
|
-
|
|
4
|
-
import httpx
|
|
5
|
-
|
|
6
|
-
from ... import errors
|
|
7
|
-
from ...client import Client
|
|
8
|
-
from ...models.http_validation_error import HTTPValidationError
|
|
9
|
-
from ...models.key_scope import KeyScope
|
|
10
|
-
from ...models.new_user_key import NewUserKey
|
|
11
|
-
from ...types import UNSET, Response, Unset
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def _get_kwargs(
|
|
15
|
-
*,
|
|
16
|
-
client: Client,
|
|
17
|
-
scope: KeyScope,
|
|
18
|
-
alias: Union[Unset, None, str] = "",
|
|
19
|
-
) -> Dict[str, Any]:
|
|
20
|
-
url = "{}/keys/".format(client.base_url)
|
|
21
|
-
|
|
22
|
-
headers: Dict[str, str] = client.get_headers()
|
|
23
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
24
|
-
|
|
25
|
-
params: Dict[str, Any] = {}
|
|
26
|
-
json_scope = scope.value
|
|
27
|
-
|
|
28
|
-
params["scope"] = json_scope
|
|
29
|
-
|
|
30
|
-
params["alias"] = alias
|
|
31
|
-
|
|
32
|
-
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
"method": "post",
|
|
36
|
-
"url": url,
|
|
37
|
-
"headers": headers,
|
|
38
|
-
"cookies": cookies,
|
|
39
|
-
"timeout": client.get_timeout(),
|
|
40
|
-
"follow_redirects": client.follow_redirects,
|
|
41
|
-
"params": params,
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[HTTPValidationError, NewUserKey]]:
|
|
46
|
-
if response.status_code == HTTPStatus.CREATED:
|
|
47
|
-
response_201 = NewUserKey.from_dict(response.json())
|
|
48
|
-
|
|
49
|
-
return response_201
|
|
50
|
-
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
|
51
|
-
response_422 = HTTPValidationError.from_dict(response.json())
|
|
52
|
-
|
|
53
|
-
return response_422
|
|
54
|
-
if client.raise_on_unexpected_status:
|
|
55
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
56
|
-
else:
|
|
57
|
-
return None
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[HTTPValidationError, NewUserKey]]:
|
|
61
|
-
return Response(
|
|
62
|
-
status_code=HTTPStatus(response.status_code),
|
|
63
|
-
content=response.content,
|
|
64
|
-
headers=response.headers,
|
|
65
|
-
parsed=_parse_response(client=client, response=response),
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
def sync_detailed(
|
|
70
|
-
*,
|
|
71
|
-
client: Client,
|
|
72
|
-
scope: KeyScope,
|
|
73
|
-
alias: Union[Unset, None, str] = "",
|
|
74
|
-
) -> Response[Union[HTTPValidationError, NewUserKey]]:
|
|
75
|
-
"""Create
|
|
76
|
-
|
|
77
|
-
Args:
|
|
78
|
-
scope (KeyScope): An enumeration.
|
|
79
|
-
alias (Union[Unset, None, str]): Default: ''.
|
|
80
|
-
|
|
81
|
-
Raises:
|
|
82
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
83
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
84
|
-
|
|
85
|
-
Returns:
|
|
86
|
-
Response[Union[HTTPValidationError, NewUserKey]]
|
|
87
|
-
"""
|
|
88
|
-
|
|
89
|
-
kwargs = _get_kwargs(
|
|
90
|
-
client=client,
|
|
91
|
-
scope=scope,
|
|
92
|
-
alias=alias,
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
response = httpx.request(
|
|
96
|
-
verify=client.verify_ssl,
|
|
97
|
-
**kwargs,
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
return _build_response(client=client, response=response)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
def sync(
|
|
104
|
-
*,
|
|
105
|
-
client: Client,
|
|
106
|
-
scope: KeyScope,
|
|
107
|
-
alias: Union[Unset, None, str] = "",
|
|
108
|
-
) -> Optional[Union[HTTPValidationError, NewUserKey]]:
|
|
109
|
-
"""Create
|
|
110
|
-
|
|
111
|
-
Args:
|
|
112
|
-
scope (KeyScope): An enumeration.
|
|
113
|
-
alias (Union[Unset, None, str]): Default: ''.
|
|
114
|
-
|
|
115
|
-
Raises:
|
|
116
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
117
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
118
|
-
|
|
119
|
-
Returns:
|
|
120
|
-
Union[HTTPValidationError, NewUserKey]
|
|
121
|
-
"""
|
|
122
|
-
|
|
123
|
-
return sync_detailed(
|
|
124
|
-
client=client,
|
|
125
|
-
scope=scope,
|
|
126
|
-
alias=alias,
|
|
127
|
-
).parsed
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
async def asyncio_detailed(
|
|
131
|
-
*,
|
|
132
|
-
client: Client,
|
|
133
|
-
scope: KeyScope,
|
|
134
|
-
alias: Union[Unset, None, str] = "",
|
|
135
|
-
) -> Response[Union[HTTPValidationError, NewUserKey]]:
|
|
136
|
-
"""Create
|
|
137
|
-
|
|
138
|
-
Args:
|
|
139
|
-
scope (KeyScope): An enumeration.
|
|
140
|
-
alias (Union[Unset, None, str]): Default: ''.
|
|
141
|
-
|
|
142
|
-
Raises:
|
|
143
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
144
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
145
|
-
|
|
146
|
-
Returns:
|
|
147
|
-
Response[Union[HTTPValidationError, NewUserKey]]
|
|
148
|
-
"""
|
|
149
|
-
|
|
150
|
-
kwargs = _get_kwargs(
|
|
151
|
-
client=client,
|
|
152
|
-
scope=scope,
|
|
153
|
-
alias=alias,
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
157
|
-
response = await _client.request(**kwargs)
|
|
158
|
-
|
|
159
|
-
return _build_response(client=client, response=response)
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
async def asyncio(
|
|
163
|
-
*,
|
|
164
|
-
client: Client,
|
|
165
|
-
scope: KeyScope,
|
|
166
|
-
alias: Union[Unset, None, str] = "",
|
|
167
|
-
) -> Optional[Union[HTTPValidationError, NewUserKey]]:
|
|
168
|
-
"""Create
|
|
169
|
-
|
|
170
|
-
Args:
|
|
171
|
-
scope (KeyScope): An enumeration.
|
|
172
|
-
alias (Union[Unset, None, str]): Default: ''.
|
|
173
|
-
|
|
174
|
-
Raises:
|
|
175
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
176
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
177
|
-
|
|
178
|
-
Returns:
|
|
179
|
-
Union[HTTPValidationError, NewUserKey]
|
|
180
|
-
"""
|
|
181
|
-
|
|
182
|
-
return (
|
|
183
|
-
await asyncio_detailed(
|
|
184
|
-
client=client,
|
|
185
|
-
scope=scope,
|
|
186
|
-
alias=alias,
|
|
187
|
-
)
|
|
188
|
-
).parsed
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
from http import HTTPStatus
|
|
2
|
-
from typing import Any, Dict, Optional, Union, cast
|
|
3
|
-
|
|
4
|
-
import httpx
|
|
5
|
-
|
|
6
|
-
from ... import errors
|
|
7
|
-
from ...client import Client
|
|
8
|
-
from ...models.http_validation_error import HTTPValidationError
|
|
9
|
-
from ...types import Response
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def _get_kwargs(
|
|
13
|
-
id: str,
|
|
14
|
-
*,
|
|
15
|
-
client: Client,
|
|
16
|
-
) -> Dict[str, Any]:
|
|
17
|
-
url = "{}/keys/{id}".format(client.base_url, id=id)
|
|
18
|
-
|
|
19
|
-
headers: Dict[str, str] = client.get_headers()
|
|
20
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
"method": "delete",
|
|
24
|
-
"url": url,
|
|
25
|
-
"headers": headers,
|
|
26
|
-
"cookies": cookies,
|
|
27
|
-
"timeout": client.get_timeout(),
|
|
28
|
-
"follow_redirects": client.follow_redirects,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
|
|
33
|
-
if response.status_code == HTTPStatus.NO_CONTENT:
|
|
34
|
-
response_204 = cast(Any, None)
|
|
35
|
-
return response_204
|
|
36
|
-
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
|
37
|
-
response_422 = HTTPValidationError.from_dict(response.json())
|
|
38
|
-
|
|
39
|
-
return response_422
|
|
40
|
-
if client.raise_on_unexpected_status:
|
|
41
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
42
|
-
else:
|
|
43
|
-
return None
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
|
|
47
|
-
return Response(
|
|
48
|
-
status_code=HTTPStatus(response.status_code),
|
|
49
|
-
content=response.content,
|
|
50
|
-
headers=response.headers,
|
|
51
|
-
parsed=_parse_response(client=client, response=response),
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def sync_detailed(
|
|
56
|
-
id: str,
|
|
57
|
-
*,
|
|
58
|
-
client: Client,
|
|
59
|
-
) -> Response[Union[Any, HTTPValidationError]]:
|
|
60
|
-
"""Delete
|
|
61
|
-
|
|
62
|
-
Args:
|
|
63
|
-
id (str):
|
|
64
|
-
|
|
65
|
-
Raises:
|
|
66
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
67
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
68
|
-
|
|
69
|
-
Returns:
|
|
70
|
-
Response[Union[Any, HTTPValidationError]]
|
|
71
|
-
"""
|
|
72
|
-
|
|
73
|
-
kwargs = _get_kwargs(
|
|
74
|
-
id=id,
|
|
75
|
-
client=client,
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
response = httpx.request(
|
|
79
|
-
verify=client.verify_ssl,
|
|
80
|
-
**kwargs,
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
return _build_response(client=client, response=response)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
def sync(
|
|
87
|
-
id: str,
|
|
88
|
-
*,
|
|
89
|
-
client: Client,
|
|
90
|
-
) -> Optional[Union[Any, HTTPValidationError]]:
|
|
91
|
-
"""Delete
|
|
92
|
-
|
|
93
|
-
Args:
|
|
94
|
-
id (str):
|
|
95
|
-
|
|
96
|
-
Raises:
|
|
97
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
98
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
99
|
-
|
|
100
|
-
Returns:
|
|
101
|
-
Union[Any, HTTPValidationError]
|
|
102
|
-
"""
|
|
103
|
-
|
|
104
|
-
return sync_detailed(
|
|
105
|
-
id=id,
|
|
106
|
-
client=client,
|
|
107
|
-
).parsed
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
async def asyncio_detailed(
|
|
111
|
-
id: str,
|
|
112
|
-
*,
|
|
113
|
-
client: Client,
|
|
114
|
-
) -> Response[Union[Any, HTTPValidationError]]:
|
|
115
|
-
"""Delete
|
|
116
|
-
|
|
117
|
-
Args:
|
|
118
|
-
id (str):
|
|
119
|
-
|
|
120
|
-
Raises:
|
|
121
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
122
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
123
|
-
|
|
124
|
-
Returns:
|
|
125
|
-
Response[Union[Any, HTTPValidationError]]
|
|
126
|
-
"""
|
|
127
|
-
|
|
128
|
-
kwargs = _get_kwargs(
|
|
129
|
-
id=id,
|
|
130
|
-
client=client,
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
134
|
-
response = await _client.request(**kwargs)
|
|
135
|
-
|
|
136
|
-
return _build_response(client=client, response=response)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
async def asyncio(
|
|
140
|
-
id: str,
|
|
141
|
-
*,
|
|
142
|
-
client: Client,
|
|
143
|
-
) -> Optional[Union[Any, HTTPValidationError]]:
|
|
144
|
-
"""Delete
|
|
145
|
-
|
|
146
|
-
Args:
|
|
147
|
-
id (str):
|
|
148
|
-
|
|
149
|
-
Raises:
|
|
150
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
151
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
152
|
-
|
|
153
|
-
Returns:
|
|
154
|
-
Union[Any, HTTPValidationError]
|
|
155
|
-
"""
|
|
156
|
-
|
|
157
|
-
return (
|
|
158
|
-
await asyncio_detailed(
|
|
159
|
-
id=id,
|
|
160
|
-
client=client,
|
|
161
|
-
)
|
|
162
|
-
).parsed
|