Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

dankmemer.py

dankmemer.py is a lightweight asynchronous Python wrapper for Dank Memer item data. Version 1.0.0rc3 uses the limited Gwapes items API and provides typed response objects, built-in caching, filtering, and optional client-side rate-limit protection.

Read the full documentation.

Important Service and Rules Notice

Release Status

This package is currently prepared as 1.0.0rc3. With the default client, only client.items is supported.

Installation

Python 3.11 or newer is required.

Both package aliases are available:

pip install dankmemer
pip install dankmemer.py

Supported Routes

The default client supports only client.items through Gwapes. The existing route attributes remain present for API compatibility, but calling any other route raises UnsupportedRouteException before an HTTP request is made.

Callers that explicitly provide a non-Gwapes base_url retain the legacy route request behaviour for compatible custom servers. Those servers are not officially supported or guaranteed by this package.

Gwapes supplies fewer fields than the former DankAlert endpoint:

Item field availability

Existing Item attribute

Gwapes source

name

name

imageURL

attachment

marketValue

value

netValue

net_value

rarity and type

Split from the combined Gwapes type value

id, details, emoji, flavor, hasUse, itemKey, skins, tags, and value

Unavailable and returned as None

The following legacy route attributes are unavailable with the default client:

  • client.all

  • client.baits

  • client.buckets

  • client.creatures

  • client.decorations

  • client.events

  • client.locations

  • client.npcs

  • client.seasons

  • client.skills

  • client.skillsdata

  • client.stream

  • client.tanks

  • client.tools

Features

  • Async aiohttp client with context-manager and manual-close usage

  • Built-in caching with configurable TTL

  • Cache clearing and cache state introspection

  • Configurable retry handling for rate limits, temporary server errors, timeouts, and connection errors

  • Configurable logging modes with default coloured console logs, silent logging, inherited application logging, or a custom logger

  • Exact, fuzzy, membership, numeric range, above, and below filters

  • Immutable dataclass response objects for route data

  • Optional anti-rate-limit handling

Quick Start

import asyncio
from dankmemer import DankMemerClient, Fuzzy, ItemsFilter

async def main():
    async with DankMemerClient() as client:
        items = await client.items.query()
        print(items[0].name)

        filtered_items = await client.items.query(
            ItemsFilter(name=Fuzzy("trash", cutoff=80))
        )
        print([item.name for item in filtered_items])

asyncio.run(main())

Manual Client Close

import asyncio
from dankmemer import DankMemerClient

async def main():
    client = DankMemerClient()
    try:
        items = await client.items.query()
        print(len(items))
    finally:
        await client.close()

asyncio.run(main())

Cache Control

Responses are cached by route for 24 hours by default. Set cache_ttl_hours=0 or cache_ttl_hours=None to disable caching.

async with DankMemerClient(cache_ttl_hours=0) as client:
    first = await client.items.query()
    second = await client.items.query()

async with DankMemerClient() as client:
    await client.items.query()
    client.items.clear_cache()
    client.clear_route_cache("items")
    client.clear_cache()
    print(client.items.cache_info())

Retries, Logging, and Sessions

The client retries HTTP 429 responses and selected temporary server errors by default. Retry-After headers are respected when present.

client = DankMemerClient(
    retry_attempts=2,
    retry_backoff=0.5,
    retry_on_rate_limit=True,
)

DankMemerClient configures logging when a client is created. The default is logging_mode="default", which installs the package’s coloured console handler on the dankmemer logger. The package does not attach this handler at import time and it is not duplicated when multiple clients are created.

Use logging_mode="null" for silent logging, or logging_mode="inherit" to leave output handling to your application or root logging configuration. Pass logger=... when your application wants direct control over client logs; a custom logger is used as-is.

import logging

default_client = DankMemerClient()
explicit_default = DankMemerClient(logging_mode="default")
silent_client = DankMemerClient(logging_mode="null")
inherited_client = DankMemerClient(logging_mode="inherit")

api_logger = logging.getLogger("myapp.dankmemer")
custom_client = DankMemerClient(logger=api_logger)

If you pass an existing aiohttp.ClientSession, the client will not close it. Sessions created by DankMemerClient are closed by close() and by the async context manager.

Documentation

Full documentation is under development and will be published at:

https://dankmemerpy.readthedocs.io/en/latest/

Issues and contributions are welcome on GitHub.

Metadata

Release files for dankmemer 1.0.0rc3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dankmemer 1.0.0rc3
File Size Uploaded Provenance Actions
dankmemer-1.0.0rc3.tar.gz 31.5 kB Without provenance Details for dankmemer-1.0.0rc3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dankmemer 1.0.0rc3
File Interpreter ABI Platform Actions
dankmemer-1.0.0rc3-py3-none-any.whl Python 3 none any Details for dankmemer-1.0.0rc3-py3-none-any.whl

Total release size: 80.1 kB

Release files / dankmemer-1.0.0rc3.tar.gz

Download URL dankmemer-1.0.0rc3.tar.gz
Size 31.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ac09ab9c8f98fa99bbc016935a1d339c585507c608836d93661e0c2e2ee23712
BLAKE2b-256 checksum
How to use checksums
9bee9173d0cdbcc7fff6b8659152a772e81a55817d61727ee67c45724d567880
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / dankmemer-1.0.0rc3-py3-none-any.whl

Download URL dankmemer-1.0.0rc3-py3-none-any.whl
Size 48.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4d0ba02304ebbb6587bedece3d818a7fc75982ed536c2e23b7a916bbdb0d886
BLAKE2b-256 checksum
How to use checksums
f13abd709221a0dd5d382da1ff45e0799278c0af0d7026a7ace9af58c359b962
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Security for dankmemer 1.0.0rc3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page