File Operations

Delete File

The delete_file function allows you to delete a file from the Perseus server.

Synchronous

delete_file

def delete_file(file_id: str) -> None:

Deletes a file by its ID.

Arguments

NameTypeDescription
file_idstrThe unique ID of the file to delete.

Returns

This function does not return any value. It raises an exception on failure.

Example

import perseus_client

try:
    perseus_client.delete_file("your_file_id_to_delete")
    print("File deleted successfully.")
except Exception as e:
    print(f"An error occurred: {e}")

Asynchronous

delete_file_async

async def delete_file_async(file_id: str) -> None:

Asynchronously deletes a file by its ID.

Arguments

NameTypeDescription
file_idstrThe unique ID of the file to delete.

Returns

This function does not return any value. It raises an exception on failure.

Example

import asyncio
import perseus_client

async def main():
    try:
        await perseus_client.delete_file_async("your_file_id_to_delete")
        print("File deleted successfully.")
    except Exception as e:
        print(f"An error occurred: {e}")
    finally:
        await perseus_client.close_async()

if __name__ == "__main__":
    asyncio.run(main())