Skip to main content

A lightweight async wrapper for the DankAlert API.

Project description

Release candidate Notice:

dankmemer.py is currently in its release candidate stage. At this stage, all routes are implemented however they may be a few bugs present.

dankmemer.py is a lightweight asynchronous Python wrapper for the DankAlert API — it allows you to easily access Dank Memer-related data (such as items and NPCs) using powerful filtering and built-in caching.

🚀 Features

  • Built-in caching with configurable TTL

  • Powerful filtering with support for exact, fuzzy, membership (IN), and numeric range queries

  • Anti-rate-limit handling

📦 Installation

You can install the project using either of the following aliases:

pip install dankmemer
pip install dankmemer.py

💡 Basic Usage Example

Below are two examples that demonstrate filtering using the new interfaces.

Example 1: Filtering Items

# This example prints the names of items where the 'name' field contains either "melmsie" or "appl"
print(
    [
        e.name for e in (
            await client.items.query(ItemsFilter(name=IN("melmsie", "appl")))
        )
    ]
)

Example 2: Filtering NPCs

# This example prints the names of NPCs whose name contains the substring "chad"
print(
    [
        e.name for e in (
            await client.npcs.query(NPCsFilter(name=IN("chad")))
        )
    ]
)

Quick Start:

Below is a minimal example that shows how to use the client with filtering:

import asyncio
from dankmemer import DankMemerClient, ItemsFilter, NPCsFilter, Fuzzy, IN

async def main():
    async with DankMemerClient() as client:
        # Query all items (no filtering)
        all_items = await client.items.query()
        print("All items:", all_items)

        # Query items with fuzzy matching on name.
        filtered_items = await client.items.query(ItemsFilter(name=Fuzzy("trash", cutoff=80)))
        print("Filtered items:", filtered_items)

        # Query NPCs with membership filtering on name.
        filtered_npcs = await client.npcs.query(NPCsFilter(name=IN("chad")))
        print("Filtered NPCs:", filtered_npcs)

asyncio.run(main())

Documentation:

Full documentation is under development and will soon be available on Read the Docs at:

https://dankmemerpy.readthedocs.io

Feel free to test, report issues, and contribute to this alpha release!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dankmemer_py-1.0.0rc1.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dankmemer_py-1.0.0rc1-py3-none-any.whl (45.1 kB view details)

Uploaded Python 3

File details

Details for the file dankmemer_py-1.0.0rc1.tar.gz.

File metadata

  • Download URL: dankmemer_py-1.0.0rc1.tar.gz
  • Upload date:
  • Size: 25.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for dankmemer_py-1.0.0rc1.tar.gz
Algorithm Hash digest
SHA256 32b8530d97591f12fc2c49e29b126fce1d8e5bfe08c0e91ab637e8414f05903e
MD5 b3a34f474c0034041b3ff796fcb0b53c
BLAKE2b-256 d9e764948c4acb1470b04c24f9feb7b85cc437658c229a3650a18c09c323a9b3

See more details on using hashes here.

File details

Details for the file dankmemer_py-1.0.0rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for dankmemer_py-1.0.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 eeb5a7bc31a3ca10cfce7590d4113d5e8651057f6a824bcd41926a599ed188ff
MD5 b9b4640ee067d5be5d52f9e22037048d
BLAKE2b-256 8d5b3cad9eb558dec34a0b3a28e6119e83ff72ffbd3a325e86b8f4f2110a665c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page