Your first request

Set your token as shown in Installation, then save this as launcher.py. You can run it without a Discord bot:

launcher.py
import asyncio
import os

from dankmemer import DankMemer


async def main() -> None:
    async with DankMemer(os.environ["DANK_MEMER_API_TOKEN"]) as dank:
        item = await dank.items.get("Life Saver")
        if item is not None:
            print(f"{item.name}: market value {item.market_value:,}")


if __name__ == "__main__":
    asyncio.run(main())

Run python launcher.py. If the item exists, the program prints its name and market value.

async def defines an asynchronous function. await waits for the requested data without blocking the rest of your application. asyncio.run(main()) creates the event loop for this standalone program.

The async with block starts the client and closes its HTTP session when the block ends, including when an exception is raised. Keep one client open for your application’s lifetime so requests can share connections and cached data.

Finding an item

await dank.items.get("Life Saver") looks up an exact item name while ignoring case and surrounding whitespace. It returns an Item or None when no matching name exists. Check for None before accessing its fields. If more than one item has the name, the library raises AmbiguousLookupError so you can choose an ID explicitly.

Name lookup loads the complete item catalog on its first use. Further lookups reuse it for one hour by default. Working with resources explains searches, filters, refreshing values, and pagination.

Where to go next