Package: aiobungie
aiobungieA statically typed, asynchronous API wrapper for building clients for Bungie's API in Python.InstallingCurrently Python 3.10, 3.11 and 3.12 are supported.Stable release.pipinstallaiobungieDevelopment via github master.pipinstallgit+https://github.com/nxtlo/aiobungie@masterQuick ExampleSeeExamples for advance usage.importaiobungieclient=aiobungie.Client('YOUR_API_KEY')asyncdefmain()->None:# Fetch a Destiny 2 character passing a component.# This includes Equipments, Inventory, Records, etc.asyncwithclient.rest:my_warlock=awaitclient.fetch_character(member_id=4611686018484639825,membership_type=aiobungie.MembershipType.STEAM,character_id=2305843009444904605,components=[aiobungie.ComponentType.CHARACTER_EQUIPMENT],)# Other components will be populated when passed to `components=[...]`# Otherwise will be `None`# Make sure the component is fetched.assertmy_warlock.equipmentisnotNone# Get the first item equipped on this character.item=my_warlock.equipment[0]print(item.hash,item.location)# Fetch this item, Note that this performs an HTTP request.# Alternatively, You can use the manifest here instead.# See examples folder for more information.item=awaitclient.fetch_inventory_item(item.hash)print(item.name,item.type_and_tier_name)# Prints: Izanagi's Burden Exotic Sniper Rifle# You can either run it using the client or just asyncio.run(main())client.run(main())RESTful clientsaiobungie also provides a stand-aloneRESTClient/RESTPoolwhich's whatClientbuilt on top of, These clients just provide a lower-level abstraction.A key note is that anyClientbased user can access theRESTClientinstance bound to it with.restproperty.Key FeaturesLower level, allows to read and deserialize the JSON objects yourself.RESTClients do not turn response payloads into one ofaiobungie.cratesobject.RESTful, You can use this as your REST API client in backend directly.BothManifestandOAuthmethods are usable directly.Exampleimportaiobungieimportasyncio# Single REST client connection.client=aiobungie.RESTClient("...")asyncdefmain()->None:asyncwithclient:# Download and open the JSON manifest.manifest=awaitclient.download_json_manifest(name="latest_manifest")withmanifest.open("r")asfile:data=file.read()# OAuth2 API. 2 simple methods for fetching and refreshing tokens.tokens=awaitclient.fetch_oauth2_tokens('code')refreshed_tokens=awaitclient.refresh_access_token(tokens.refresh_token)# Testing your own requests.response=awaitclient.static_request("GET",# Method."Destiny2/path/to/route",# Route.auth="optional_access_token",# If the method requires OAuth2.json={"some_key":"some_value"}# If you need to pass JSON data.)asyncio.run(main())Dependanciesaiohttpattrsbackports.datetime_fromisoformat, required forPython 3.10only.Featuresaiobungie features are extra dependencies that replaces the standard library with either faster/neater pkgs.speedupThis will include and usesorjsonorujsonas the defaultjsonparser. They provide faster json serialization and de-serialization than the standard Python JSON pkg.full: This will include all of the features above.For installing the specified feature, typepip install aiobungie[feature-name]ContributingPlease read thismanualRelated ProjectsIf you have used aiobungie and want to show your work, Feel free to Open a PR including it.Fated: A Discord BOT that uses aiobungie.Useful ResourcesDiscord Username:vfateaiobungie Documentation:Here.BungieAPI Discord:HereOfficial Bungie Documentation:HereBungie Developer Portal:HereAdditional informationIf you have any question you can either open a blank issue, open a new github discussion, or just tag me in BungieAPI discord server.