Skip to main content

A lightweight async wrapper for the DankAlert API.

Project description

Alpha Release Notice:

dankmemer.py is currently in alpha. At this stage, only the items route is implemented. Future releases will include additional routes and enhanced features.

dankmemer.py is a simple and powerful asynchronous Python wrapper for the DankAlert API — giving you easy access to Dank Memer-related data like items, NPCs, skills, tools, and more.

🚀 Features

  • Built-in caching with configurable TTL

  • Powerful filtering with support for exact, fuzzy, and numeric range queries

📦 Installation

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

pip install dankmemer
pip install dankmemer.py

Items Route

The Items Route provides access to the /items endpoint from the DankAlert API. It automatically caches responses for a configurable period, converts raw JSON into Item objects, and allows easy filtering via the ItemsFilter class and the Fuzzy helper.

Basic Example

import asyncio
from dankmemer import DankMemerClient, ItemsFilter, Fuzzy

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

        # Example: Filtering items using various criteria:
        # - Fuzzy matching on the 'name' field (e.g. items with names similar to "trash")
        # - Boolean filtering for 'hasUse' flag
        # - Numeric range filtering for 'marketValue'
        filter_obj = ItemsFilter(
            name=Fuzzy("trash", cutoff=80),  # Fuzzy match on name with a cutoff of 80%
            hasUse=False,                    # Only items that are not usable
            marketValue=(5000, 10000000)      # Market value between 5,000 and 10,000,000
        )

        filtered_items = await client.items.query(filter_obj)
        print("Filtered items:", filtered_items)

asyncio.run(main())

This basic example demonstrates: - Exact vs. Fuzzy Matching: Use a plain string for exact matches (e.g. name="Trash") or wrap your string with the Fuzzy helper (e.g. name=Fuzzy("trash", cutoff=80)) for fuzzy matching. - Numeric Range Filtering: Supply a tuple (min, max) to filter numeric fields such as marketValue. - Boolean Filtering: Directly pass boolean values (e.g. hasUse=True).

Documentation

Full documentation for dankmemer.py can be found 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-0.1.0a3.tar.gz (9.3 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-0.1.0a3-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file dankmemer_py-0.1.0a3.tar.gz.

File metadata

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

File hashes

Hashes for dankmemer_py-0.1.0a3.tar.gz
Algorithm Hash digest
SHA256 7752b1ebd1f0122fcd1d6e5f39297d4aa495451373a633130afe7aff0cab51e9
MD5 aab1969c05918fa5ed1f155424bb9da2
BLAKE2b-256 be13389f4937b5ddbd64fd8eeac909f24a01b0b49b683c12988d61913e2f51cb

See more details on using hashes here.

File details

Details for the file dankmemer_py-0.1.0a3-py3-none-any.whl.

File metadata

  • Download URL: dankmemer_py-0.1.0a3-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for dankmemer_py-0.1.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 9206feec78488cb3c64c88d5147e00f4d30ac064d4d8d62e5ffc775897585e16
MD5 520084c38a9ce5cb04648e91ab0a01c4
BLAKE2b-256 3299f6879a08e7e7966642aa1e7d37b113b264caa622eada0d4d2aab204d4aa0

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