Skip to main content

A Python and Asyncio API for Bungie.

Project description

aiobungie

A statically typed API wrapper for the Bungie's REST API written in Python3 and Asyncio.

Installing

PyPI stable release.

$ pip install aiobungie

Development

$ pip install git+https://github.com/nxtlo/aiobungie@master

Quick Example

See Examples for advance usage.

import aiobungie

client = aiobungie.Client('YOUR_API_KEY')

async def main() -> None:

    # Fetch a charatcer with all its components.
    # This includes Equimpents, Inventory, Records, etc.
    async with client.rest:
        my_warlock = await client.fetch_character(
            membership_id,
            aiobungie.MembershipType.STEAM,
            character_id,
            components=[aiobungie.Component.ALL_CHARACTERS]
        )

        for activity in my_warlock.activities:
            # Check if activity is a raid.
            if activity.current_mode and activity.current_mode is aiobungie.GameMode.RAID:
                print(activity.avaliable_activities) # All raids for this character.

# You can either run it using the client or just asyncio.run(main())
client.run(main())

RESTful clients

Alternatively, You can use RESTClient which's designed to only make HTTP requests and return JSON objects. and to interact with the manifest.

Example

import aiobungie
import asyncio

# Single REST client connection.
client = aiobungie.RESTClient("...")

async def main() -> None:
    async with client:
        # SQLite manifest.
        await client.download_manifest()

        # OAuth2 API.
        tokens = await client.fetch_oauth2_tokens('code')

asyncio.run(main())

Requirements

  • Python 3.9 or higher
  • aiohttp
  • attrs

Contributing

Please read this manual

Getting Help

  • Discord: Fate 怒#0008 | 350750086357057537
  • Docs: Here.

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

aiobungie-0.2.7.tar.gz (111.1 kB view hashes)

Uploaded Source

Built Distribution

aiobungie-0.2.7-py3-none-any.whl (148.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page