Skip to content

Kigstn/BungIO

Repository files navigation

BungIO Logo

BungIO


BungIO is a modern and pythonic wrapper for Bungies Destiny 2 API.

  • Python 3.10+
  • Asynchronous
  • 100% typed and raw api coverage
  • Ratelimit compliant
  • Manifest support
  • OAuth2 support
  • Easily used in combination with other libraries like FastApi

Click here to get started or visit the guides or api reference.

Basic Example

import asyncio
import os

from bungio import Client
from bungio.models import BungieMembershipType, DestinyActivityModeType, DestinyUser


# create the client obj with our bungie authentication
client = Client(
    bungie_client_id=os.getenv("BUNGIE_CLIENT_ID"),
    bungie_client_secret=os.getenv("BUNGIE_CLIENT_SECRET"),
    bungie_token=os.getenv("BUNGIE_TOKEN"),
)

async def main():
    # create a user obj using a known bungie id
    user = DestinyUser(membership_id=4611686018467765462, membership_type=BungieMembershipType.TIGER_STEAM)

    # iterate thought the raids that user has played
    async for activity in user.yield_activity_history(mode=DestinyActivityModeType.RAID):

        # print the date of the activity
        print(activity.period)

# bungio is by nature asynchronous, it can only be run in an asynchronous context
asyncio.run(main())

Dev Setup

Install Dependencies

  • pip install uv
  • uv pip install -e .[speedups,cache,docs,test,dev]

Run Tests

  • pytest .

Run Docs

  • mkdocs serve