Skip to content

Hexay/donutsmp-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DonutSMP API Wrapper

PyPI - Version PyPI - Downloads

An async Python wrapper for the DonutSMP API with full type safety using Pydantic models.

Installation

pip install donutsmp-api

Quick Start

import asyncio
from donut import DonutClient

async def main():
    async with DonutClient("your-api-key") as client:
        stats = await client.stats("archivepedro")
        print(stats)

asyncio.run(main())

Features

  • Fully async with aiohttp
  • Type-safe responses via Pydantic models
  • Built-in rate limiting (configurable)
  • Support for multiple API keys (automatic rotation)

API Reference

Client Configuration

client = DonutClient(
    api_keys="key",              # Single key or list of keys
    timeout=30.0,                # Request timeout in seconds
    requests_per_minute=250      # Rate limit per key
)

Stats

# Single lookup
stats = await client.stats("username")

# Batch lookup
stats_list = await client.stats.batch(["user1", "user2", "user3"])

Leaderboards

# Single page
leaderboard = await client.leaderboards("money", page=1)

# Batch fetch multiple pages
pages = await client.leaderboards.batch("money", start_page=1, end_page=100)

# Category shortcuts
await client.leaderboards.money(page=1)
await client.leaderboards.kills(page=1)
await client.leaderboards.playtime(page=1)

Available categories: money, shards, playtime, kills, deaths, mobskilled, brokenblocks, placedblocks, sell, shop

Auction House

# List active auctions
auctions = await client.auction.list(page=1, search="diamond", sort="price_asc")

# Recent transactions
transactions = await client.auction.transactions(page=1)

Player Lookup

# Single lookup
player = await client.lookup("username")

# Batch lookup
players = await client.lookup.batch(["user1", "user2", "user3"])

Examples

See the examples directory for more usage patterns:

License

MIT

About

An asynchronous, feature-rich, DonutSMP API wrapper for Python

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages