A Python and Asyncio API for Bungie.
Project description
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 clan
clan = await client.fetch_clan("Nuanceㅤ")
for member in await clan.fetch_members():
if member.unique_name == "Fate怒#4275":
# Get the profile for this clan member.
profile = await member.fetch_self_profile(components=[aiobungie.ComponentType.CHARACTERS])
# Get the character component for the profile.
if characters := profile.characters:
for character in characters.values():
print(character.class_type, character.light, character.gender)
# Check some character stats.
for stat, stat_value in character.stats.items():
if stat is aiobungie.Stat.MOBILITY and stat_value > 90:
print(f"Zooming {stat_value} ⭐")
# You can either run it using the client or just `asyncio.run(main())`
client.run(main())
RESTful client
Alternatively, You can use RESTClient
which's designed to only make HTTP requests and return JSON objects.
Quick Example
import aiobungie
import asyncio
async def main(access_token: str) -> None:
async with aiobungie.RESTClient("TOKEN") as rest_client:
response = await rest_client.fetch_clan_members(4389205)
raw_members_payload = response['results']
for member in raw_members_payload:
for k, v in member['destinyUserInfo'].items():
print(k, v)
# aiobungie also exposes a method which lets you make your own requests.
await rest.static_request("POST", "Some/Endpoint", auth=access_token, json={...: ...})
# Methods only exposed through the rest client.
await rest.refresh_access_token('a token')
asyncio.run(main("DB_ACCESS_TOKEN"))
Requirements
- Python 3.9 or higher
- aiohttp
- attrs
Contributing
Please read this manual
Getting Help
- Discord:
Fate 怒#0008
|350750086357057537
- Docs: Here.
Project details
Release history Release notifications | RSS feed
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.6a2.tar.gz
(112.3 kB
view hashes)
Built Distribution
aiobungie-0.2.6a2-py3-none-any.whl
(147.9 kB
view hashes)
Close
Hashes for aiobungie-0.2.6a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e0e8d9228c015224de198d7049f704490dc37c5f0f09457df97d4ec7f1a6f3a |
|
MD5 | a9998e70c6e30ce0cf768edb33147ec9 |
|
BLAKE2b-256 | 34644d9d36a010b35b740b5a2ab8c26464d5b02329dff6268075f13b5b7aed5b |