A Python module for interacting with all of DmmD's (soon to be various) APIs.
uv add git@github.com:iiPythonx/dmmd-pyfrom dmmd.icdn import iCDN
connection = iCDN()CLI
icdn query <UUID>
icdn search --begin --end --minimum --maximum --count --loose --order --page --sort --tags --uuid --query NAME
icdn list --count --page --query
icdn add --file --token --time NAME
icdn update --file --token --time --uuid NAME
icdn remove --token <UUID>
icdn detailsNearly everything is optional, for more information, run icdn --help or check DmmD's detailed API docs.
Supported Endpoints
class SortOrder(Enum):
ASCENDING
DESCENDING
class SortType(Enum):
NAME
TIME
UUID
type DataModel = {
data: dict
mime: str
name: str
size: int
tags: list[str]
time: datetime
uuid: str
}
type StoreModel = {
file_limit: int
store_limit: int
store_length: int
store_size: int
protected: bool
}
async iCDN.file(uuid: str) -> bytes
async iCDN.query(uuid: str) -> DataModel
async iCDN.add(
file: Path,
name: str,
data?: dict = {},
tags?: list[str] = [],
time?: datetime = datetime.now(),
token?: str
) -> DataModel
async iCDN.update(
uuid: str,
file?: Path,
name?: str,
data?: dict = {},
tags?: list[str] = [],
time?: datetime = datetime.now(),
token?: str
) -> DataModel
async iCDN.remove(
uuid: str,
token?: str
) -> DataModel
async iCDN.store() -> StoreModel
iCDN.search(
begin?: int,
end?: int,
minimum?: int,
maximum?: int
count? int = 25,
loose?: bool = False,
name?: str,
order?: SortOrder = SortOrder.DESCENDING,
page?: int = 0,
sort?: SortType = SortType.TIME,
tags?: list[str],
uuid?: str
} -> BuiltCallable
iCDN.list(
count?: int = 25
page?: int = 0
) -> BuiltCallable
async BuiltCallable.fetch() -> list[UUID]
async BuiltCallable.query() -> list[DataModel]All endpoints that support querying must be called first with your arguments, and then awaited with any additional options. An example of this is as follows:
endpoint = iCDN.search("bocchi the rock")
await endpoint.query() # Returns a list of BaseModels
await endpoint.fetch() # Returns a list of UUIDsExceptions
- dmmd.exceptions.DmmDException
- dmmd.exceptions.BadFile
- dmmd.exceptions.BadJSON
- dmmd.exceptions.GenericInvalid
- dmmd.exceptions.InvalidData
- dmmd.exceptions.InvalidName
- dmmd.exceptions.InvalidTags
- dmmd.exceptions.InvalidTime
- dmmd.exceptions.InvalidToken
- dmmd.exceptions.InvalidUUID
- dmmd.exceptions.LargeSource
- dmmd.exceptions.MissingAsset
- dmmd.exceptions.MissingContent
- dmmd.exceptions.UnauthorizedToken
- dmmd.exceptions.UnsupportedMime
from dmmd.static import Static
connection = Static()Supported Endpoints
async Static.directory(path?: str = "") -> list[str]
async Static.file(path: str) -> bytesExceptions
- dmmd.exceptions.DmmDException
- dmmd.exceptions.OutOfBoundsFile
- dmmd.exceptions.UnknownEndpoint
- dmmd.exceptions.UnknownDirectory
- dmmd.exceptions.UnknownFile
from dmmd.data import Data
connection = Data()Supported Endpoints
type Tag = {
id: str
name: str
}
type Anime = {
begin: str | None
comment: str | Noned
end: str | None
id: str
name: str
rating: int | float | None
tags: list[str]
title: str
wiki: str | None
}
type Game = Anime | {
users: list[str]
}
async Data.tags() -> list[Tag]
async Data.anime() -> list[Anime]
async Data.games() -> list[Game]- dmmd.exceptions.DmmDException
- dmmd.exceptions.ServerError
- Fired when the server replies with an unknown status code.
- dmmd.exceptions.UnauthorizedToken
- dmmd.exceptions.ServerError