Backup
SeaDexBackup
SeaDexBackup(
email: str,
password: str,
base_url: str = "https://releases.moe",
client: Client | None = None,
)
Client to interact with the SeaDex backup API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
email
|
str
|
The email address for authentication. |
required |
password
|
str
|
The password for authentication. |
required |
base_url
|
str
|
The base URL of SeaDex, used for constructing API queries. |
'https://releases.moe'
|
client
|
Client
|
An |
None
|
Examples:
with SeaDexBackup("me@email.com", "password") as seadex_backup:
print(seadex_backup.latest_backup)
#> @auto_pb_backup_sea_dex_20241122000000.zip
Notes
Only SeaDex admins can use this! Logging in with a non-admin account will result in failure.
Source code in src/seadex/_backup.py
backups
property
backups: tuple[BackupFile, ...]
Retrieve a tuple of backup files.
Returns:
Type | Description |
---|---|
tuple[BackupFile, ...]
|
A tuple of backup files, sorted by the modified date. |
latest_backup
property
latest_backup: BackupFile
close
create
create(filename: str) -> BackupFile
Create a new backup with the specified filename.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str
|
The name to assign to the backup file.
The filename must contain only lowercase alphabets, numbers, hyphens, or underscores.
It may also include formatting options as supported by |
required |
Returns:
Type | Description |
---|---|
BackupFile
|
The newly created backup file. |
Raises:
Type | Description |
---|---|
ValueError
|
If the filename is invalid. |
Source code in src/seadex/_backup.py
delete
delete(file: str | BackupFile) -> None
Delete the specified backup file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file
|
str | BackupFile
|
The backup file to delete. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/seadex/_backup.py
download
download(
file: str | BackupFile | None = None,
*,
destination: StrPath | None = None,
overwrite: bool = False,
) -> Path
Download the specified backup file to the given destination directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file
|
str | BackupFile | None
|
The backup file to download. If |
None
|
destination
|
StrPath | None
|
The destination directory to save the backup. |
None
|
overwrite
|
bool
|
Whether to overwrite the file if it already exists. |
False
|
Returns:
Type | Description |
---|---|
Path
|
The path to the downloaded backup file. |
Raises:
Type | Description |
---|---|
NotADirectoryError
|
If the destination is not a valid directory. |
BadBackupFileError
|
If the downloaded backup file fails integrity check. |
TypeError
|
If the provided |