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,200 +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.uploaded_file_result import UploadedFileResult
|
|
10
|
-
from ...types import Response
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def _get_kwargs(
|
|
14
|
-
full_path: str,
|
|
15
|
-
*,
|
|
16
|
-
client: Client,
|
|
17
|
-
) -> Dict[str, Any]:
|
|
18
|
-
url = "{}/storage/link/{full_path}".format(client.base_url, full_path=full_path)
|
|
19
|
-
|
|
20
|
-
headers: Dict[str, str] = client.get_headers()
|
|
21
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
"method": "get",
|
|
25
|
-
"url": url,
|
|
26
|
-
"headers": headers,
|
|
27
|
-
"cookies": cookies,
|
|
28
|
-
"timeout": client.get_timeout(),
|
|
29
|
-
"follow_redirects": client.follow_redirects,
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def _parse_response(
|
|
34
|
-
*, client: Client, response: httpx.Response
|
|
35
|
-
) -> Optional[Union[HTTPValidationError, UploadedFileResult]]:
|
|
36
|
-
if response.status_code == HTTPStatus.OK:
|
|
37
|
-
response_200 = UploadedFileResult.from_dict(response.json())
|
|
38
|
-
|
|
39
|
-
return response_200
|
|
40
|
-
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
|
41
|
-
response_422 = HTTPValidationError.from_dict(response.json())
|
|
42
|
-
|
|
43
|
-
return response_422
|
|
44
|
-
if client.raise_on_unexpected_status:
|
|
45
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
46
|
-
else:
|
|
47
|
-
return None
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def _build_response(
|
|
51
|
-
*, client: Client, response: httpx.Response
|
|
52
|
-
) -> Response[Union[HTTPValidationError, UploadedFileResult]]:
|
|
53
|
-
return Response(
|
|
54
|
-
status_code=HTTPStatus(response.status_code),
|
|
55
|
-
content=response.content,
|
|
56
|
-
headers=response.headers,
|
|
57
|
-
parsed=_parse_response(client=client, response=response),
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def sync_detailed(
|
|
62
|
-
full_path: str,
|
|
63
|
-
*,
|
|
64
|
-
client: Client,
|
|
65
|
-
) -> Response[Union[HTTPValidationError, UploadedFileResult]]:
|
|
66
|
-
"""Get Signed Link From Shared Storage
|
|
67
|
-
|
|
68
|
-
Sign a link to a file in the shared storage bucket.
|
|
69
|
-
These can be from the upload_to_shared_storage endpoint
|
|
70
|
-
Or from a model upload.
|
|
71
|
-
|
|
72
|
-
Examples:
|
|
73
|
-
- /{PROJECT_ID}_toolkit_bucket/github_2745502/fal_ai_sdxl_1690489104504.png
|
|
74
|
-
- /fal_file_storage/d0bdd5b7c2c6495cb4d763547bdd8fde.png
|
|
75
|
-
|
|
76
|
-
Args:
|
|
77
|
-
full_path (str):
|
|
78
|
-
|
|
79
|
-
Raises:
|
|
80
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
81
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
82
|
-
|
|
83
|
-
Returns:
|
|
84
|
-
Response[Union[HTTPValidationError, UploadedFileResult]]
|
|
85
|
-
"""
|
|
86
|
-
|
|
87
|
-
kwargs = _get_kwargs(
|
|
88
|
-
full_path=full_path,
|
|
89
|
-
client=client,
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
response = httpx.request(
|
|
93
|
-
verify=client.verify_ssl,
|
|
94
|
-
**kwargs,
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
return _build_response(client=client, response=response)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
def sync(
|
|
101
|
-
full_path: str,
|
|
102
|
-
*,
|
|
103
|
-
client: Client,
|
|
104
|
-
) -> Optional[Union[HTTPValidationError, UploadedFileResult]]:
|
|
105
|
-
"""Get Signed Link From Shared Storage
|
|
106
|
-
|
|
107
|
-
Sign a link to a file in the shared storage bucket.
|
|
108
|
-
These can be from the upload_to_shared_storage endpoint
|
|
109
|
-
Or from a model upload.
|
|
110
|
-
|
|
111
|
-
Examples:
|
|
112
|
-
- /{PROJECT_ID}_toolkit_bucket/github_2745502/fal_ai_sdxl_1690489104504.png
|
|
113
|
-
- /fal_file_storage/d0bdd5b7c2c6495cb4d763547bdd8fde.png
|
|
114
|
-
|
|
115
|
-
Args:
|
|
116
|
-
full_path (str):
|
|
117
|
-
|
|
118
|
-
Raises:
|
|
119
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
120
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
121
|
-
|
|
122
|
-
Returns:
|
|
123
|
-
Union[HTTPValidationError, UploadedFileResult]
|
|
124
|
-
"""
|
|
125
|
-
|
|
126
|
-
return sync_detailed(
|
|
127
|
-
full_path=full_path,
|
|
128
|
-
client=client,
|
|
129
|
-
).parsed
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
async def asyncio_detailed(
|
|
133
|
-
full_path: str,
|
|
134
|
-
*,
|
|
135
|
-
client: Client,
|
|
136
|
-
) -> Response[Union[HTTPValidationError, UploadedFileResult]]:
|
|
137
|
-
"""Get Signed Link From Shared Storage
|
|
138
|
-
|
|
139
|
-
Sign a link to a file in the shared storage bucket.
|
|
140
|
-
These can be from the upload_to_shared_storage endpoint
|
|
141
|
-
Or from a model upload.
|
|
142
|
-
|
|
143
|
-
Examples:
|
|
144
|
-
- /{PROJECT_ID}_toolkit_bucket/github_2745502/fal_ai_sdxl_1690489104504.png
|
|
145
|
-
- /fal_file_storage/d0bdd5b7c2c6495cb4d763547bdd8fde.png
|
|
146
|
-
|
|
147
|
-
Args:
|
|
148
|
-
full_path (str):
|
|
149
|
-
|
|
150
|
-
Raises:
|
|
151
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
152
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
153
|
-
|
|
154
|
-
Returns:
|
|
155
|
-
Response[Union[HTTPValidationError, UploadedFileResult]]
|
|
156
|
-
"""
|
|
157
|
-
|
|
158
|
-
kwargs = _get_kwargs(
|
|
159
|
-
full_path=full_path,
|
|
160
|
-
client=client,
|
|
161
|
-
)
|
|
162
|
-
|
|
163
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
164
|
-
response = await _client.request(**kwargs)
|
|
165
|
-
|
|
166
|
-
return _build_response(client=client, response=response)
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
async def asyncio(
|
|
170
|
-
full_path: str,
|
|
171
|
-
*,
|
|
172
|
-
client: Client,
|
|
173
|
-
) -> Optional[Union[HTTPValidationError, UploadedFileResult]]:
|
|
174
|
-
"""Get Signed Link From Shared Storage
|
|
175
|
-
|
|
176
|
-
Sign a link to a file in the shared storage bucket.
|
|
177
|
-
These can be from the upload_to_shared_storage endpoint
|
|
178
|
-
Or from a model upload.
|
|
179
|
-
|
|
180
|
-
Examples:
|
|
181
|
-
- /{PROJECT_ID}_toolkit_bucket/github_2745502/fal_ai_sdxl_1690489104504.png
|
|
182
|
-
- /fal_file_storage/d0bdd5b7c2c6495cb4d763547bdd8fde.png
|
|
183
|
-
|
|
184
|
-
Args:
|
|
185
|
-
full_path (str):
|
|
186
|
-
|
|
187
|
-
Raises:
|
|
188
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
189
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
190
|
-
|
|
191
|
-
Returns:
|
|
192
|
-
Union[HTTPValidationError, UploadedFileResult]
|
|
193
|
-
"""
|
|
194
|
-
|
|
195
|
-
return (
|
|
196
|
-
await asyncio_detailed(
|
|
197
|
-
full_path=full_path,
|
|
198
|
-
client=client,
|
|
199
|
-
)
|
|
200
|
-
).parsed
|
|
@@ -1,172 +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.initiate_upload_info import InitiateUploadInfo
|
|
10
|
-
from ...models.presigned_upload_url import PresignedUploadUrl
|
|
11
|
-
from ...types import Response
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def _get_kwargs(
|
|
15
|
-
*,
|
|
16
|
-
client: Client,
|
|
17
|
-
json_body: InitiateUploadInfo,
|
|
18
|
-
) -> Dict[str, Any]:
|
|
19
|
-
url = "{}/storage/upload/initiate".format(client.base_url)
|
|
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(
|
|
38
|
-
*, client: Client, response: httpx.Response
|
|
39
|
-
) -> Optional[Union[HTTPValidationError, PresignedUploadUrl]]:
|
|
40
|
-
if response.status_code == HTTPStatus.OK:
|
|
41
|
-
response_200 = PresignedUploadUrl.from_dict(response.json())
|
|
42
|
-
|
|
43
|
-
return response_200
|
|
44
|
-
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
|
45
|
-
response_422 = HTTPValidationError.from_dict(response.json())
|
|
46
|
-
|
|
47
|
-
return response_422
|
|
48
|
-
if client.raise_on_unexpected_status:
|
|
49
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
50
|
-
else:
|
|
51
|
-
return None
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def _build_response(
|
|
55
|
-
*, client: Client, response: httpx.Response
|
|
56
|
-
) -> Response[Union[HTTPValidationError, PresignedUploadUrl]]:
|
|
57
|
-
return Response(
|
|
58
|
-
status_code=HTTPStatus(response.status_code),
|
|
59
|
-
content=response.content,
|
|
60
|
-
headers=response.headers,
|
|
61
|
-
parsed=_parse_response(client=client, response=response),
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def sync_detailed(
|
|
66
|
-
*,
|
|
67
|
-
client: Client,
|
|
68
|
-
json_body: InitiateUploadInfo,
|
|
69
|
-
) -> Response[Union[HTTPValidationError, PresignedUploadUrl]]:
|
|
70
|
-
"""Initiate Upload
|
|
71
|
-
|
|
72
|
-
Args:
|
|
73
|
-
json_body (InitiateUploadInfo):
|
|
74
|
-
|
|
75
|
-
Raises:
|
|
76
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
77
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
78
|
-
|
|
79
|
-
Returns:
|
|
80
|
-
Response[Union[HTTPValidationError, PresignedUploadUrl]]
|
|
81
|
-
"""
|
|
82
|
-
|
|
83
|
-
kwargs = _get_kwargs(
|
|
84
|
-
client=client,
|
|
85
|
-
json_body=json_body,
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
response = httpx.request(
|
|
89
|
-
verify=client.verify_ssl,
|
|
90
|
-
**kwargs,
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
return _build_response(client=client, response=response)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
def sync(
|
|
97
|
-
*,
|
|
98
|
-
client: Client,
|
|
99
|
-
json_body: InitiateUploadInfo,
|
|
100
|
-
) -> Optional[Union[HTTPValidationError, PresignedUploadUrl]]:
|
|
101
|
-
"""Initiate Upload
|
|
102
|
-
|
|
103
|
-
Args:
|
|
104
|
-
json_body (InitiateUploadInfo):
|
|
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, PresignedUploadUrl]
|
|
112
|
-
"""
|
|
113
|
-
|
|
114
|
-
return sync_detailed(
|
|
115
|
-
client=client,
|
|
116
|
-
json_body=json_body,
|
|
117
|
-
).parsed
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
async def asyncio_detailed(
|
|
121
|
-
*,
|
|
122
|
-
client: Client,
|
|
123
|
-
json_body: InitiateUploadInfo,
|
|
124
|
-
) -> Response[Union[HTTPValidationError, PresignedUploadUrl]]:
|
|
125
|
-
"""Initiate Upload
|
|
126
|
-
|
|
127
|
-
Args:
|
|
128
|
-
json_body (InitiateUploadInfo):
|
|
129
|
-
|
|
130
|
-
Raises:
|
|
131
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
132
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
133
|
-
|
|
134
|
-
Returns:
|
|
135
|
-
Response[Union[HTTPValidationError, PresignedUploadUrl]]
|
|
136
|
-
"""
|
|
137
|
-
|
|
138
|
-
kwargs = _get_kwargs(
|
|
139
|
-
client=client,
|
|
140
|
-
json_body=json_body,
|
|
141
|
-
)
|
|
142
|
-
|
|
143
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
144
|
-
response = await _client.request(**kwargs)
|
|
145
|
-
|
|
146
|
-
return _build_response(client=client, response=response)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
async def asyncio(
|
|
150
|
-
*,
|
|
151
|
-
client: Client,
|
|
152
|
-
json_body: InitiateUploadInfo,
|
|
153
|
-
) -> Optional[Union[HTTPValidationError, PresignedUploadUrl]]:
|
|
154
|
-
"""Initiate Upload
|
|
155
|
-
|
|
156
|
-
Args:
|
|
157
|
-
json_body (InitiateUploadInfo):
|
|
158
|
-
|
|
159
|
-
Raises:
|
|
160
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
161
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
162
|
-
|
|
163
|
-
Returns:
|
|
164
|
-
Union[HTTPValidationError, PresignedUploadUrl]
|
|
165
|
-
"""
|
|
166
|
-
|
|
167
|
-
return (
|
|
168
|
-
await asyncio_detailed(
|
|
169
|
-
client=client,
|
|
170
|
-
json_body=json_body,
|
|
171
|
-
)
|
|
172
|
-
).parsed
|
|
@@ -1,172 +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.body_upload_file import BodyUploadFile
|
|
9
|
-
from ...models.http_validation_error import HTTPValidationError
|
|
10
|
-
from ...models.uploaded_file_result import UploadedFileResult
|
|
11
|
-
from ...types import Response
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def _get_kwargs(
|
|
15
|
-
*,
|
|
16
|
-
client: Client,
|
|
17
|
-
multipart_data: BodyUploadFile,
|
|
18
|
-
) -> Dict[str, Any]:
|
|
19
|
-
url = "{}/storage/upload".format(client.base_url)
|
|
20
|
-
|
|
21
|
-
headers: Dict[str, str] = client.get_headers()
|
|
22
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
23
|
-
|
|
24
|
-
multipart_multipart_data = multipart_data.to_multipart()
|
|
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
|
-
"files": multipart_multipart_data,
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def _parse_response(
|
|
38
|
-
*, client: Client, response: httpx.Response
|
|
39
|
-
) -> Optional[Union[HTTPValidationError, UploadedFileResult]]:
|
|
40
|
-
if response.status_code == HTTPStatus.OK:
|
|
41
|
-
response_200 = UploadedFileResult.from_dict(response.json())
|
|
42
|
-
|
|
43
|
-
return response_200
|
|
44
|
-
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
|
45
|
-
response_422 = HTTPValidationError.from_dict(response.json())
|
|
46
|
-
|
|
47
|
-
return response_422
|
|
48
|
-
if client.raise_on_unexpected_status:
|
|
49
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
50
|
-
else:
|
|
51
|
-
return None
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def _build_response(
|
|
55
|
-
*, client: Client, response: httpx.Response
|
|
56
|
-
) -> Response[Union[HTTPValidationError, UploadedFileResult]]:
|
|
57
|
-
return Response(
|
|
58
|
-
status_code=HTTPStatus(response.status_code),
|
|
59
|
-
content=response.content,
|
|
60
|
-
headers=response.headers,
|
|
61
|
-
parsed=_parse_response(client=client, response=response),
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def sync_detailed(
|
|
66
|
-
*,
|
|
67
|
-
client: Client,
|
|
68
|
-
multipart_data: BodyUploadFile,
|
|
69
|
-
) -> Response[Union[HTTPValidationError, UploadedFileResult]]:
|
|
70
|
-
"""Upload To Shared Storage
|
|
71
|
-
|
|
72
|
-
Args:
|
|
73
|
-
multipart_data (BodyUploadFile):
|
|
74
|
-
|
|
75
|
-
Raises:
|
|
76
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
77
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
78
|
-
|
|
79
|
-
Returns:
|
|
80
|
-
Response[Union[HTTPValidationError, UploadedFileResult]]
|
|
81
|
-
"""
|
|
82
|
-
|
|
83
|
-
kwargs = _get_kwargs(
|
|
84
|
-
client=client,
|
|
85
|
-
multipart_data=multipart_data,
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
response = httpx.request(
|
|
89
|
-
verify=client.verify_ssl,
|
|
90
|
-
**kwargs,
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
return _build_response(client=client, response=response)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
def sync(
|
|
97
|
-
*,
|
|
98
|
-
client: Client,
|
|
99
|
-
multipart_data: BodyUploadFile,
|
|
100
|
-
) -> Optional[Union[HTTPValidationError, UploadedFileResult]]:
|
|
101
|
-
"""Upload To Shared Storage
|
|
102
|
-
|
|
103
|
-
Args:
|
|
104
|
-
multipart_data (BodyUploadFile):
|
|
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, UploadedFileResult]
|
|
112
|
-
"""
|
|
113
|
-
|
|
114
|
-
return sync_detailed(
|
|
115
|
-
client=client,
|
|
116
|
-
multipart_data=multipart_data,
|
|
117
|
-
).parsed
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
async def asyncio_detailed(
|
|
121
|
-
*,
|
|
122
|
-
client: Client,
|
|
123
|
-
multipart_data: BodyUploadFile,
|
|
124
|
-
) -> Response[Union[HTTPValidationError, UploadedFileResult]]:
|
|
125
|
-
"""Upload To Shared Storage
|
|
126
|
-
|
|
127
|
-
Args:
|
|
128
|
-
multipart_data (BodyUploadFile):
|
|
129
|
-
|
|
130
|
-
Raises:
|
|
131
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
132
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
133
|
-
|
|
134
|
-
Returns:
|
|
135
|
-
Response[Union[HTTPValidationError, UploadedFileResult]]
|
|
136
|
-
"""
|
|
137
|
-
|
|
138
|
-
kwargs = _get_kwargs(
|
|
139
|
-
client=client,
|
|
140
|
-
multipart_data=multipart_data,
|
|
141
|
-
)
|
|
142
|
-
|
|
143
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
144
|
-
response = await _client.request(**kwargs)
|
|
145
|
-
|
|
146
|
-
return _build_response(client=client, response=response)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
async def asyncio(
|
|
150
|
-
*,
|
|
151
|
-
client: Client,
|
|
152
|
-
multipart_data: BodyUploadFile,
|
|
153
|
-
) -> Optional[Union[HTTPValidationError, UploadedFileResult]]:
|
|
154
|
-
"""Upload To Shared Storage
|
|
155
|
-
|
|
156
|
-
Args:
|
|
157
|
-
multipart_data (BodyUploadFile):
|
|
158
|
-
|
|
159
|
-
Raises:
|
|
160
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
161
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
162
|
-
|
|
163
|
-
Returns:
|
|
164
|
-
Union[HTTPValidationError, UploadedFileResult]
|
|
165
|
-
"""
|
|
166
|
-
|
|
167
|
-
return (
|
|
168
|
-
await asyncio_detailed(
|
|
169
|
-
client=client,
|
|
170
|
-
multipart_data=multipart_data,
|
|
171
|
-
)
|
|
172
|
-
).parsed
|
|
File without changes
|
|
@@ -1,166 +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.body_create_token import BodyCreateToken
|
|
9
|
-
from ...models.http_validation_error import HTTPValidationError
|
|
10
|
-
from ...types import Response
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def _get_kwargs(
|
|
14
|
-
*,
|
|
15
|
-
client: Client,
|
|
16
|
-
json_body: BodyCreateToken,
|
|
17
|
-
) -> Dict[str, Any]:
|
|
18
|
-
url = "{}/tokens/".format(client.base_url)
|
|
19
|
-
|
|
20
|
-
headers: Dict[str, str] = client.get_headers()
|
|
21
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
22
|
-
|
|
23
|
-
json_json_body = json_body.to_dict()
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
"method": "post",
|
|
27
|
-
"url": url,
|
|
28
|
-
"headers": headers,
|
|
29
|
-
"cookies": cookies,
|
|
30
|
-
"timeout": client.get_timeout(),
|
|
31
|
-
"follow_redirects": client.follow_redirects,
|
|
32
|
-
"json": json_json_body,
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[HTTPValidationError, str]]:
|
|
37
|
-
if response.status_code == HTTPStatus.CREATED:
|
|
38
|
-
response_201 = cast(str, response.json())
|
|
39
|
-
return response_201
|
|
40
|
-
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
|
41
|
-
response_422 = HTTPValidationError.from_dict(response.json())
|
|
42
|
-
|
|
43
|
-
return response_422
|
|
44
|
-
if client.raise_on_unexpected_status:
|
|
45
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
46
|
-
else:
|
|
47
|
-
return None
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[HTTPValidationError, str]]:
|
|
51
|
-
return Response(
|
|
52
|
-
status_code=HTTPStatus(response.status_code),
|
|
53
|
-
content=response.content,
|
|
54
|
-
headers=response.headers,
|
|
55
|
-
parsed=_parse_response(client=client, response=response),
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def sync_detailed(
|
|
60
|
-
*,
|
|
61
|
-
client: Client,
|
|
62
|
-
json_body: BodyCreateToken,
|
|
63
|
-
) -> Response[Union[HTTPValidationError, str]]:
|
|
64
|
-
"""Create Token
|
|
65
|
-
|
|
66
|
-
Args:
|
|
67
|
-
json_body (BodyCreateToken):
|
|
68
|
-
|
|
69
|
-
Raises:
|
|
70
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
71
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
72
|
-
|
|
73
|
-
Returns:
|
|
74
|
-
Response[Union[HTTPValidationError, str]]
|
|
75
|
-
"""
|
|
76
|
-
|
|
77
|
-
kwargs = _get_kwargs(
|
|
78
|
-
client=client,
|
|
79
|
-
json_body=json_body,
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
response = httpx.request(
|
|
83
|
-
verify=client.verify_ssl,
|
|
84
|
-
**kwargs,
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
return _build_response(client=client, response=response)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
def sync(
|
|
91
|
-
*,
|
|
92
|
-
client: Client,
|
|
93
|
-
json_body: BodyCreateToken,
|
|
94
|
-
) -> Optional[Union[HTTPValidationError, str]]:
|
|
95
|
-
"""Create Token
|
|
96
|
-
|
|
97
|
-
Args:
|
|
98
|
-
json_body (BodyCreateToken):
|
|
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
|
-
Union[HTTPValidationError, str]
|
|
106
|
-
"""
|
|
107
|
-
|
|
108
|
-
return sync_detailed(
|
|
109
|
-
client=client,
|
|
110
|
-
json_body=json_body,
|
|
111
|
-
).parsed
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
async def asyncio_detailed(
|
|
115
|
-
*,
|
|
116
|
-
client: Client,
|
|
117
|
-
json_body: BodyCreateToken,
|
|
118
|
-
) -> Response[Union[HTTPValidationError, str]]:
|
|
119
|
-
"""Create Token
|
|
120
|
-
|
|
121
|
-
Args:
|
|
122
|
-
json_body (BodyCreateToken):
|
|
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
|
-
Response[Union[HTTPValidationError, str]]
|
|
130
|
-
"""
|
|
131
|
-
|
|
132
|
-
kwargs = _get_kwargs(
|
|
133
|
-
client=client,
|
|
134
|
-
json_body=json_body,
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
138
|
-
response = await _client.request(**kwargs)
|
|
139
|
-
|
|
140
|
-
return _build_response(client=client, response=response)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
async def asyncio(
|
|
144
|
-
*,
|
|
145
|
-
client: Client,
|
|
146
|
-
json_body: BodyCreateToken,
|
|
147
|
-
) -> Optional[Union[HTTPValidationError, str]]:
|
|
148
|
-
"""Create Token
|
|
149
|
-
|
|
150
|
-
Args:
|
|
151
|
-
json_body (BodyCreateToken):
|
|
152
|
-
|
|
153
|
-
Raises:
|
|
154
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
155
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
156
|
-
|
|
157
|
-
Returns:
|
|
158
|
-
Union[HTTPValidationError, str]
|
|
159
|
-
"""
|
|
160
|
-
|
|
161
|
-
return (
|
|
162
|
-
await asyncio_detailed(
|
|
163
|
-
client=client,
|
|
164
|
-
json_body=json_body,
|
|
165
|
-
)
|
|
166
|
-
).parsed
|
|
File without changes
|