(file)
Initiate file upload.
import os
from friendli import SyncFriendli
with SyncFriendli(
token=os.getenv("FRIENDLI_TOKEN", ""),
) as friendli:
res = friendli.file.init_upload(
digest="<value>", name="<value>", project_id="<id>", size=830650
)
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
digest |
str |
✔️ |
Digest of the file. |
name |
str |
✔️ |
Name of the file. |
project_id |
str |
✔️ |
ID of the project the file belongs to. |
size |
int |
✔️ |
Size of the file in bytes. |
x_friendli_team |
OptionalNullable[str] |
➖ |
ID of team to run requests as (optional parameter). |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.FileInitUploadResponse
| Error Type |
Status Code |
Content Type |
| models.HTTPValidationError |
422 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
Complete file upload.
import os
from friendli import SyncFriendli
with SyncFriendli(
token=os.getenv("FRIENDLI_TOKEN", ""),
) as friendli:
res = friendli.file.complete_upload(file_id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
file_id |
str |
✔️ |
File ID |
x_friendli_team |
OptionalNullable[str] |
➖ |
ID of team to run requests as (optional parameter). |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
Any
| Error Type |
Status Code |
Content Type |
| models.HTTPValidationError |
422 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
Get file info.
import os
from friendli import SyncFriendli
with SyncFriendli(
token=os.getenv("FRIENDLI_TOKEN", ""),
) as friendli:
res = friendli.file.get_info(file_id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
file_id |
str |
✔️ |
File ID |
x_friendli_team |
OptionalNullable[str] |
➖ |
ID of team to run requests as (optional parameter). |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.FileInfo
| Error Type |
Status Code |
Content Type |
| models.HTTPValidationError |
422 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
Get file download URL.
import os
from friendli import SyncFriendli
with SyncFriendli(
token=os.getenv("FRIENDLI_TOKEN", ""),
) as friendli:
res = friendli.file.get_download_url(file_id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
file_id |
str |
✔️ |
File ID |
x_friendli_team |
OptionalNullable[str] |
➖ |
ID of team to run requests as (optional parameter). |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.FileGetDownloadURLResponse
| Error Type |
Status Code |
Content Type |
| models.HTTPValidationError |
422 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |