Skip to main content

A destiny 2 / bungie api wrapper

Project description

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.

Why BungIO?

What sets this library apart from other projects is that it has full api coverage - every single route is fully typed and returns fully typed python classes! And better yet, the api is automatically generated from the api spec bungie publishes. This means when there is an update to the api, it needs literally one button click from me to update the library to the latest api version with the new shiny features.

This means that all api features are fully supported and support for new API feature is added in seconds. This has the downside, that everything follows the Bungie API spec - so if there is an error in the published spec, the same error will be in this library.

Destiny Manifest Support

The manifest is where bungie defines all their data: activities, emblems, items, etc. Normally you need to constantly look up data from the api in the manifest, because the api only returns basic info / ids.

For example: You want to look up what activity your user has done last. So you call the correct api route which returns an activity id. You then have to download the manifest and look up that activity id in the correct manifest location. Only then you get additional information like the activity name, light level, location, etc. As you can probably imagine, this gets annoying veeeery quickly.

BungIO provides helper functions to make manifest lookups stupidly easy. Take a look at the manifest guide for more information :)

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

Run Tests

  • uv run pytest .

Run Docs

  • uv run mkdocs serve

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

bungio-1.7.0.tar.gz (305.6 kB view details)

Uploaded Source

Built Distribution

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

bungio-1.7.0-py3-none-any.whl (412.3 kB view details)

Uploaded Python 3

File details

Details for the file bungio-1.7.0.tar.gz.

File metadata

  • Download URL: bungio-1.7.0.tar.gz
  • Upload date:
  • Size: 305.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for bungio-1.7.0.tar.gz
Algorithm Hash digest
SHA256 f3c48cf5f366b4b7f5756231bec1d533709990be26b34fc47d351b5491900698
MD5 ad0e4ca622bd40e6fbfe93de0b9bc654
BLAKE2b-256 e2903aff7137d60aadfba47d819a9742e959829f0540b9705e9d0019b7d286ba

See more details on using hashes here.

File details

Details for the file bungio-1.7.0-py3-none-any.whl.

File metadata

  • Download URL: bungio-1.7.0-py3-none-any.whl
  • Upload date:
  • Size: 412.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for bungio-1.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f4270f01530511aff14d5980f9d47e7a2867a4a62bc0a6588230864d24c9cd34
MD5 b66db08b82c812a6109df294d5c27f11
BLAKE2b-256 55624d883e1deab1e095502662bc7017a3fe94c728880c513c30eb41ef58572d

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