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,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
|
-
file: str,
|
|
14
|
-
*,
|
|
15
|
-
client: Client,
|
|
16
|
-
) -> Dict[str, Any]:
|
|
17
|
-
url = "{}/files/file/{file}".format(client.base_url, file=file)
|
|
18
|
-
|
|
19
|
-
headers: Dict[str, str] = client.get_headers()
|
|
20
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
"method": "get",
|
|
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.OK:
|
|
34
|
-
response_200 = cast(Any, response.json())
|
|
35
|
-
return response_200
|
|
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
|
-
file: str,
|
|
57
|
-
*,
|
|
58
|
-
client: Client,
|
|
59
|
-
) -> Response[Union[Any, HTTPValidationError]]:
|
|
60
|
-
"""Download File
|
|
61
|
-
|
|
62
|
-
Args:
|
|
63
|
-
file (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
|
-
file=file,
|
|
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
|
-
file: str,
|
|
88
|
-
*,
|
|
89
|
-
client: Client,
|
|
90
|
-
) -> Optional[Union[Any, HTTPValidationError]]:
|
|
91
|
-
"""Download File
|
|
92
|
-
|
|
93
|
-
Args:
|
|
94
|
-
file (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
|
-
file=file,
|
|
106
|
-
client=client,
|
|
107
|
-
).parsed
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
async def asyncio_detailed(
|
|
111
|
-
file: str,
|
|
112
|
-
*,
|
|
113
|
-
client: Client,
|
|
114
|
-
) -> Response[Union[Any, HTTPValidationError]]:
|
|
115
|
-
"""Download File
|
|
116
|
-
|
|
117
|
-
Args:
|
|
118
|
-
file (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
|
-
file=file,
|
|
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
|
-
file: str,
|
|
141
|
-
*,
|
|
142
|
-
client: Client,
|
|
143
|
-
) -> Optional[Union[Any, HTTPValidationError]]:
|
|
144
|
-
"""Download File
|
|
145
|
-
|
|
146
|
-
Args:
|
|
147
|
-
file (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
|
-
file=file,
|
|
160
|
-
client=client,
|
|
161
|
-
)
|
|
162
|
-
).parsed
|
|
@@ -1,183 +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.file_spec import FileSpec
|
|
9
|
-
from ...models.http_validation_error import HTTPValidationError
|
|
10
|
-
from ...types import UNSET, Response, Unset
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def _get_kwargs(
|
|
14
|
-
file: str,
|
|
15
|
-
*,
|
|
16
|
-
client: Client,
|
|
17
|
-
calculate_checksum: Union[Unset, None, bool] = False,
|
|
18
|
-
) -> Dict[str, Any]:
|
|
19
|
-
url = "{}/files/file/exists/{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
|
-
params: Dict[str, Any] = {}
|
|
25
|
-
params["calculate_checksum"] = calculate_checksum
|
|
26
|
-
|
|
27
|
-
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
"method": "post",
|
|
31
|
-
"url": url,
|
|
32
|
-
"headers": headers,
|
|
33
|
-
"cookies": cookies,
|
|
34
|
-
"timeout": client.get_timeout(),
|
|
35
|
-
"follow_redirects": client.follow_redirects,
|
|
36
|
-
"params": params,
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[FileSpec, HTTPValidationError]]:
|
|
41
|
-
if response.status_code == HTTPStatus.OK:
|
|
42
|
-
response_200 = FileSpec.from_dict(response.json())
|
|
43
|
-
|
|
44
|
-
return response_200
|
|
45
|
-
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
|
46
|
-
response_422 = HTTPValidationError.from_dict(response.json())
|
|
47
|
-
|
|
48
|
-
return response_422
|
|
49
|
-
if client.raise_on_unexpected_status:
|
|
50
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
51
|
-
else:
|
|
52
|
-
return None
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[FileSpec, HTTPValidationError]]:
|
|
56
|
-
return Response(
|
|
57
|
-
status_code=HTTPStatus(response.status_code),
|
|
58
|
-
content=response.content,
|
|
59
|
-
headers=response.headers,
|
|
60
|
-
parsed=_parse_response(client=client, response=response),
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def sync_detailed(
|
|
65
|
-
file: str,
|
|
66
|
-
*,
|
|
67
|
-
client: Client,
|
|
68
|
-
calculate_checksum: Union[Unset, None, bool] = False,
|
|
69
|
-
) -> Response[Union[FileSpec, HTTPValidationError]]:
|
|
70
|
-
"""File Exists
|
|
71
|
-
|
|
72
|
-
Args:
|
|
73
|
-
file (str):
|
|
74
|
-
calculate_checksum (Union[Unset, None, bool]):
|
|
75
|
-
|
|
76
|
-
Raises:
|
|
77
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
78
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
79
|
-
|
|
80
|
-
Returns:
|
|
81
|
-
Response[Union[FileSpec, HTTPValidationError]]
|
|
82
|
-
"""
|
|
83
|
-
|
|
84
|
-
kwargs = _get_kwargs(
|
|
85
|
-
file=file,
|
|
86
|
-
client=client,
|
|
87
|
-
calculate_checksum=calculate_checksum,
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
response = httpx.request(
|
|
91
|
-
verify=client.verify_ssl,
|
|
92
|
-
**kwargs,
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
return _build_response(client=client, response=response)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def sync(
|
|
99
|
-
file: str,
|
|
100
|
-
*,
|
|
101
|
-
client: Client,
|
|
102
|
-
calculate_checksum: Union[Unset, None, bool] = False,
|
|
103
|
-
) -> Optional[Union[FileSpec, HTTPValidationError]]:
|
|
104
|
-
"""File Exists
|
|
105
|
-
|
|
106
|
-
Args:
|
|
107
|
-
file (str):
|
|
108
|
-
calculate_checksum (Union[Unset, None, bool]):
|
|
109
|
-
|
|
110
|
-
Raises:
|
|
111
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
112
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
113
|
-
|
|
114
|
-
Returns:
|
|
115
|
-
Union[FileSpec, HTTPValidationError]
|
|
116
|
-
"""
|
|
117
|
-
|
|
118
|
-
return sync_detailed(
|
|
119
|
-
file=file,
|
|
120
|
-
client=client,
|
|
121
|
-
calculate_checksum=calculate_checksum,
|
|
122
|
-
).parsed
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
async def asyncio_detailed(
|
|
126
|
-
file: str,
|
|
127
|
-
*,
|
|
128
|
-
client: Client,
|
|
129
|
-
calculate_checksum: Union[Unset, None, bool] = False,
|
|
130
|
-
) -> Response[Union[FileSpec, HTTPValidationError]]:
|
|
131
|
-
"""File Exists
|
|
132
|
-
|
|
133
|
-
Args:
|
|
134
|
-
file (str):
|
|
135
|
-
calculate_checksum (Union[Unset, None, bool]):
|
|
136
|
-
|
|
137
|
-
Raises:
|
|
138
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
139
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
140
|
-
|
|
141
|
-
Returns:
|
|
142
|
-
Response[Union[FileSpec, HTTPValidationError]]
|
|
143
|
-
"""
|
|
144
|
-
|
|
145
|
-
kwargs = _get_kwargs(
|
|
146
|
-
file=file,
|
|
147
|
-
client=client,
|
|
148
|
-
calculate_checksum=calculate_checksum,
|
|
149
|
-
)
|
|
150
|
-
|
|
151
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
152
|
-
response = await _client.request(**kwargs)
|
|
153
|
-
|
|
154
|
-
return _build_response(client=client, response=response)
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
async def asyncio(
|
|
158
|
-
file: str,
|
|
159
|
-
*,
|
|
160
|
-
client: Client,
|
|
161
|
-
calculate_checksum: Union[Unset, None, bool] = False,
|
|
162
|
-
) -> Optional[Union[FileSpec, HTTPValidationError]]:
|
|
163
|
-
"""File Exists
|
|
164
|
-
|
|
165
|
-
Args:
|
|
166
|
-
file (str):
|
|
167
|
-
calculate_checksum (Union[Unset, None, bool]):
|
|
168
|
-
|
|
169
|
-
Raises:
|
|
170
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
171
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
172
|
-
|
|
173
|
-
Returns:
|
|
174
|
-
Union[FileSpec, HTTPValidationError]
|
|
175
|
-
"""
|
|
176
|
-
|
|
177
|
-
return (
|
|
178
|
-
await asyncio_detailed(
|
|
179
|
-
file=file,
|
|
180
|
-
client=client,
|
|
181
|
-
calculate_checksum=calculate_checksum,
|
|
182
|
-
)
|
|
183
|
-
).parsed
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
from http import HTTPStatus
|
|
2
|
-
from typing import Any, Dict, List, Optional, Union
|
|
3
|
-
|
|
4
|
-
import httpx
|
|
5
|
-
|
|
6
|
-
from ... import errors
|
|
7
|
-
from ...client import Client
|
|
8
|
-
from ...models.file_spec import FileSpec
|
|
9
|
-
from ...models.http_validation_error import HTTPValidationError
|
|
10
|
-
from ...types import Response
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def _get_kwargs(
|
|
14
|
-
dir_: str,
|
|
15
|
-
*,
|
|
16
|
-
client: Client,
|
|
17
|
-
) -> Dict[str, Any]:
|
|
18
|
-
url = "{}/files/list/{dir}".format(client.base_url, dir=dir_)
|
|
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, List["FileSpec"]]]:
|
|
36
|
-
if response.status_code == HTTPStatus.OK:
|
|
37
|
-
response_200 = []
|
|
38
|
-
_response_200 = response.json()
|
|
39
|
-
for response_200_item_data in _response_200:
|
|
40
|
-
response_200_item = FileSpec.from_dict(response_200_item_data)
|
|
41
|
-
|
|
42
|
-
response_200.append(response_200_item)
|
|
43
|
-
|
|
44
|
-
return response_200
|
|
45
|
-
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
|
46
|
-
response_422 = HTTPValidationError.from_dict(response.json())
|
|
47
|
-
|
|
48
|
-
return response_422
|
|
49
|
-
if client.raise_on_unexpected_status:
|
|
50
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
51
|
-
else:
|
|
52
|
-
return None
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def _build_response(
|
|
56
|
-
*, client: Client, response: httpx.Response
|
|
57
|
-
) -> Response[Union[HTTPValidationError, List["FileSpec"]]]:
|
|
58
|
-
return Response(
|
|
59
|
-
status_code=HTTPStatus(response.status_code),
|
|
60
|
-
content=response.content,
|
|
61
|
-
headers=response.headers,
|
|
62
|
-
parsed=_parse_response(client=client, response=response),
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
def sync_detailed(
|
|
67
|
-
dir_: str,
|
|
68
|
-
*,
|
|
69
|
-
client: Client,
|
|
70
|
-
) -> Response[Union[HTTPValidationError, List["FileSpec"]]]:
|
|
71
|
-
"""List Dir Files
|
|
72
|
-
|
|
73
|
-
Args:
|
|
74
|
-
dir_ (str):
|
|
75
|
-
|
|
76
|
-
Raises:
|
|
77
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
78
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
79
|
-
|
|
80
|
-
Returns:
|
|
81
|
-
Response[Union[HTTPValidationError, List['FileSpec']]]
|
|
82
|
-
"""
|
|
83
|
-
|
|
84
|
-
kwargs = _get_kwargs(
|
|
85
|
-
dir_=dir_,
|
|
86
|
-
client=client,
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
response = httpx.request(
|
|
90
|
-
verify=client.verify_ssl,
|
|
91
|
-
**kwargs,
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
return _build_response(client=client, response=response)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def sync(
|
|
98
|
-
dir_: str,
|
|
99
|
-
*,
|
|
100
|
-
client: Client,
|
|
101
|
-
) -> Optional[Union[HTTPValidationError, List["FileSpec"]]]:
|
|
102
|
-
"""List Dir Files
|
|
103
|
-
|
|
104
|
-
Args:
|
|
105
|
-
dir_ (str):
|
|
106
|
-
|
|
107
|
-
Raises:
|
|
108
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
109
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
110
|
-
|
|
111
|
-
Returns:
|
|
112
|
-
Union[HTTPValidationError, List['FileSpec']]
|
|
113
|
-
"""
|
|
114
|
-
|
|
115
|
-
return sync_detailed(
|
|
116
|
-
dir_=dir_,
|
|
117
|
-
client=client,
|
|
118
|
-
).parsed
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
async def asyncio_detailed(
|
|
122
|
-
dir_: str,
|
|
123
|
-
*,
|
|
124
|
-
client: Client,
|
|
125
|
-
) -> Response[Union[HTTPValidationError, List["FileSpec"]]]:
|
|
126
|
-
"""List Dir Files
|
|
127
|
-
|
|
128
|
-
Args:
|
|
129
|
-
dir_ (str):
|
|
130
|
-
|
|
131
|
-
Raises:
|
|
132
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
133
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
134
|
-
|
|
135
|
-
Returns:
|
|
136
|
-
Response[Union[HTTPValidationError, List['FileSpec']]]
|
|
137
|
-
"""
|
|
138
|
-
|
|
139
|
-
kwargs = _get_kwargs(
|
|
140
|
-
dir_=dir_,
|
|
141
|
-
client=client,
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
145
|
-
response = await _client.request(**kwargs)
|
|
146
|
-
|
|
147
|
-
return _build_response(client=client, response=response)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
async def asyncio(
|
|
151
|
-
dir_: str,
|
|
152
|
-
*,
|
|
153
|
-
client: Client,
|
|
154
|
-
) -> Optional[Union[HTTPValidationError, List["FileSpec"]]]:
|
|
155
|
-
"""List Dir Files
|
|
156
|
-
|
|
157
|
-
Args:
|
|
158
|
-
dir_ (str):
|
|
159
|
-
|
|
160
|
-
Raises:
|
|
161
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
162
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
163
|
-
|
|
164
|
-
Returns:
|
|
165
|
-
Union[HTTPValidationError, List['FileSpec']]
|
|
166
|
-
"""
|
|
167
|
-
|
|
168
|
-
return (
|
|
169
|
-
await asyncio_detailed(
|
|
170
|
-
dir_=dir_,
|
|
171
|
-
client=client,
|
|
172
|
-
)
|
|
173
|
-
).parsed
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
from http import HTTPStatus
|
|
2
|
-
from typing import Any, Dict, List, Optional, Union
|
|
3
|
-
|
|
4
|
-
import httpx
|
|
5
|
-
|
|
6
|
-
from ... import errors
|
|
7
|
-
from ...client import Client
|
|
8
|
-
from ...models.file_spec import FileSpec
|
|
9
|
-
from ...models.http_validation_error import HTTPValidationError
|
|
10
|
-
from ...types import Response
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def _get_kwargs(
|
|
14
|
-
*,
|
|
15
|
-
client: Client,
|
|
16
|
-
) -> Dict[str, Any]:
|
|
17
|
-
url = "{}/files/list".format(client.base_url)
|
|
18
|
-
|
|
19
|
-
headers: Dict[str, str] = client.get_headers()
|
|
20
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
"method": "get",
|
|
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(
|
|
33
|
-
*, client: Client, response: httpx.Response
|
|
34
|
-
) -> Optional[Union[HTTPValidationError, List["FileSpec"]]]:
|
|
35
|
-
if response.status_code == HTTPStatus.OK:
|
|
36
|
-
response_200 = []
|
|
37
|
-
_response_200 = response.json()
|
|
38
|
-
for response_200_item_data in _response_200:
|
|
39
|
-
response_200_item = FileSpec.from_dict(response_200_item_data)
|
|
40
|
-
|
|
41
|
-
response_200.append(response_200_item)
|
|
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, List["FileSpec"]]]:
|
|
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
|
-
) -> Response[Union[HTTPValidationError, List["FileSpec"]]]:
|
|
69
|
-
"""List Files
|
|
70
|
-
|
|
71
|
-
Raises:
|
|
72
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
73
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
74
|
-
|
|
75
|
-
Returns:
|
|
76
|
-
Response[Union[HTTPValidationError, List['FileSpec']]]
|
|
77
|
-
"""
|
|
78
|
-
|
|
79
|
-
kwargs = _get_kwargs(
|
|
80
|
-
client=client,
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
response = httpx.request(
|
|
84
|
-
verify=client.verify_ssl,
|
|
85
|
-
**kwargs,
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
return _build_response(client=client, response=response)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
def sync(
|
|
92
|
-
*,
|
|
93
|
-
client: Client,
|
|
94
|
-
) -> Optional[Union[HTTPValidationError, List["FileSpec"]]]:
|
|
95
|
-
"""List Files
|
|
96
|
-
|
|
97
|
-
Raises:
|
|
98
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
99
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
100
|
-
|
|
101
|
-
Returns:
|
|
102
|
-
Union[HTTPValidationError, List['FileSpec']]
|
|
103
|
-
"""
|
|
104
|
-
|
|
105
|
-
return sync_detailed(
|
|
106
|
-
client=client,
|
|
107
|
-
).parsed
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
async def asyncio_detailed(
|
|
111
|
-
*,
|
|
112
|
-
client: Client,
|
|
113
|
-
) -> Response[Union[HTTPValidationError, List["FileSpec"]]]:
|
|
114
|
-
"""List Files
|
|
115
|
-
|
|
116
|
-
Raises:
|
|
117
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
118
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
119
|
-
|
|
120
|
-
Returns:
|
|
121
|
-
Response[Union[HTTPValidationError, List['FileSpec']]]
|
|
122
|
-
"""
|
|
123
|
-
|
|
124
|
-
kwargs = _get_kwargs(
|
|
125
|
-
client=client,
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
129
|
-
response = await _client.request(**kwargs)
|
|
130
|
-
|
|
131
|
-
return _build_response(client=client, response=response)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
async def asyncio(
|
|
135
|
-
*,
|
|
136
|
-
client: Client,
|
|
137
|
-
) -> Optional[Union[HTTPValidationError, List["FileSpec"]]]:
|
|
138
|
-
"""List Files
|
|
139
|
-
|
|
140
|
-
Raises:
|
|
141
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
142
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
143
|
-
|
|
144
|
-
Returns:
|
|
145
|
-
Union[HTTPValidationError, List['FileSpec']]
|
|
146
|
-
"""
|
|
147
|
-
|
|
148
|
-
return (
|
|
149
|
-
await asyncio_detailed(
|
|
150
|
-
client=client,
|
|
151
|
-
)
|
|
152
|
-
).parsed
|