Data Models¶
This library uses data models to represent both the authentication token and the data returned from the Seedr API.
The Token Object¶
The Token object is a central piece of the client, holding the authentication credentials for your session. It's designed to be a simple, immutable data container that can be easily serialized and deserialized.
seedrcc.token.Token
dataclass
¶
Represents the authentication tokens for a Seedr session.
Attributes:
| Name | Type | Description |
|---|---|---|
access_token |
str
|
|
refresh_token |
str | None
|
|
device_code |
str | None
|
|
to_dict()
¶
Returns the token data as a dictionary, excluding any fields that are None.
to_json()
¶
Returns the token data as a JSON string.
to_base64()
¶
Returns the token data as a Base64-encoded JSON string.
from_dict(data)
classmethod
¶
Creates a Token object from a dictionary.
from_json(json_str)
classmethod
¶
Creates a Token object from a JSON string.
from_base64(b64_str)
classmethod
¶
Creates a Token object from a Base64-encoded JSON string.
API Response Models¶
All data returned from the Seedr API is parsed into clean, easy-to-use data models. These models provide type-hinted attributes for all documented API fields, making it easy to work with the responses in a structured and predictable way.
Accessing Raw Data¶
All API response models provide a .get_raw() method to access the original, unmodified dictionary from the server.
# This example assumes you have a 'client' instance from a previous example
settings = client.get_settings()
# Access a typed attribute
print(settings.account.username)
# Access the raw, underlying dictionary
raw_data = settings.get_raw()
print(raw_data["account"]["username"])
Models Reference¶
seedrcc.models
¶
Torrent
dataclass
¶
Represents a torrent in the user's account.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
|
name |
str
|
|
size |
int
|
|
hash |
str
|
|
progress |
str
|
|
last_update |
datetime | None
|
|
folder |
str
|
|
download_rate |
int
|
|
upload_rate |
int
|
|
torrent_quality |
int | None
|
|
connected_to |
int
|
|
downloading_from |
int
|
|
uploading_to |
int
|
|
seeders |
int
|
|
leechers |
int
|
|
warnings |
str | None
|
|
stopped |
int
|
|
progress_url |
str | None
|
|
File
dataclass
¶
Represents a file within Seedr.
Attributes:
| Name | Type | Description |
|---|---|---|
file_id |
int
|
|
name |
str
|
|
size |
int
|
|
folder_id |
int
|
|
folder_file_id |
int
|
|
hash |
str
|
|
last_update |
datetime | None
|
|
play_audio |
bool
|
|
play_video |
bool
|
|
video_progress |
str | None
|
|
is_lost |
int
|
|
thumb |
str | None
|
|
Folder
dataclass
¶
Represents a folder, which can contain files, torrents, and other folders.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
|
name |
str
|
|
fullname |
str
|
|
size |
int
|
|
last_update |
datetime | None
|
|
is_shared |
bool
|
|
play_audio |
bool
|
|
play_video |
bool
|
|
folders |
List[ForwardRef(Folder)]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |
files |
List[File]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |
torrents |
List[ForwardRef(Torrent)]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |
parent |
int | None
|
|
timestamp |
datetime | None
|
|
indexes |
List[Any]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |
AccountSettings
dataclass
¶
Represents the nested 'settings' object in the user settings response.
Attributes:
| Name | Type | Description |
|---|---|---|
allow_remote_access |
bool
|
|
site_language |
str
|
|
subtitles_language |
str
|
|
email_announcements |
bool
|
|
email_newsletter |
bool
|
|
AccountInfo
dataclass
¶
Represents the nested 'account' object in the user settings response.
Attributes:
| Name | Type | Description |
|---|---|---|
username |
str
|
|
user_id |
int
|
|
premium |
int
|
|
package_id |
int
|
|
package_name |
str
|
|
space_used |
int
|
|
space_max |
int
|
|
bandwidth_used |
int
|
|
email |
str
|
|
wishlist |
list
|
|
invites |
int
|
|
invites_accepted |
int
|
|
max_invites |
int
|
|
UserSettings
dataclass
¶
Represents the complete response from the get_settings endpoint.
Attributes:
| Name | Type | Description |
|---|---|---|
result |
bool
|
|
code |
int
|
|
settings |
AccountSettings
|
|
account |
AccountInfo
|
|
country |
str
|
|
MemoryBandwidth
dataclass
¶
Represents the user's memory and bandwidth usage details.
Attributes:
| Name | Type | Description |
|---|---|---|
bandwidth_used |
int
|
|
bandwidth_max |
int
|
|
space_used |
int
|
|
space_max |
int
|
|
is_premium |
int
|
|
Device
dataclass
¶
Represents a device connected to the user's account.
Attributes:
| Name | Type | Description |
|---|---|---|
client_id |
str
|
|
client_name |
str
|
|
device_code |
str
|
|
tk |
str
|
|
DeviceCode
dataclass
¶
Represents the codes used in the device authentication flow.
Attributes:
| Name | Type | Description |
|---|---|---|
expires_in |
int
|
|
interval |
int
|
|
device_code |
str
|
|
user_code |
str
|
|
verification_url |
str
|
|
ScannedTorrent
dataclass
¶
Represents a torrent found by the scan_page method.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
|
hash |
str
|
|
size |
int
|
|
title |
str
|
|
magnet |
str
|
|
last_use |
datetime | None
|
|
pct |
float
|
|
filenames |
List[str]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |
filesizes |
List[int]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |
ListContentsResult
dataclass
¶
Represents the result of listing folder contents, including account metadata.
Attributes:
| Name | Type | Description |
|---|---|---|
space_used |
int
|
|
space_max |
int
|
|
saw_walkthrough |
int
|
|
type |
str
|
|
t |
List[Optional[datetime]]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |
AddTorrentResult
dataclass
¶
Represents the result of adding a torrent.
Attributes:
| Name | Type | Description |
|---|---|---|
result |
bool
|
|
user_torrent_id |
int | None
|
|
title |
str | None
|
|
torrent_hash |
str | None
|
|
code |
int | None
|
|
CreateArchiveResult
dataclass
¶
Represents the result of a request to create an archive.
Attributes:
| Name | Type | Description |
|---|---|---|
result |
bool
|
|
archive_id |
int
|
|
archive_url |
str
|
|
code |
int | None
|
|
FetchFileResult
dataclass
¶
Represents the result of a request to fetch a file, including the download URL.
Attributes:
| Name | Type | Description |
|---|---|---|
result |
bool
|
|
url |
str
|
|
name |
str
|
|
RefreshTokenResult
dataclass
¶
Represents the response from a token refresh.
Attributes:
| Name | Type | Description |
|---|---|---|
access_token |
str
|
|
expires_in |
int
|
|
token_type |
str
|
|
scope |
str | None
|
|
ScanPageResult
dataclass
¶
Represents the full result of a scan_page request.
Attributes:
| Name | Type | Description |
|---|---|---|
result |
bool
|
|
torrents |
List[ScannedTorrent]
|
|
APIResult
dataclass
¶
Represents a generic API result for operations that return a simple success/failure.
Attributes:
| Name | Type | Description |
|---|---|---|
result |
bool
|
|
code |
int | None
|
|
TorrentProgressStats
dataclass
¶
Represents the nested 'stats' object in a torrent progress response.
Attributes:
| Name | Type | Description |
|---|---|---|
torrent_hash |
str
|
|
progress |
float
|
|
title |
str
|
|
downloading_from |
int
|
|
uploading_to |
int
|
|
warnings |
str
|
|
stopped |
int
|
|
folder_created |
int
|
|
download_rate |
float
|
|
size |
int
|
|
torrent_quality |
int | None
|
|
seeders |
int
|
|
leechers |
int
|
|
seed_ratio |
float
|
|
TorrentProgress
dataclass
¶
Represents the progress data for an active torrent download.
Attributes:
| Name | Type | Description |
|---|---|---|
title |
str
|
|
size |
int
|
|
progress |
float
|
|
hash |
str
|
|
stopped |
int
|
|
download_rate |
float
|
|
stats |
TorrentProgressStats
|
|
torrent_quality |
int | None
|
|
warnings |
str
|
|
files_progress |
List[Any]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |