/bungie-api-python

A work in progress python wrapper for the Bungie API.

Primary LanguagePythonMIT LicenseMIT

Bungie API Python Wrapper

This is a work in progress python wrapper for the Bungie API.

MIT License

Test Information


GitHub Workflow Status


Planned Features

  • ❌ Complete API coverage.
    • ✔️ OAuth workflow
      • ✔️ Token endpoints (access token, refresh token)
      • ✔️ OAuth context for endpoints requiring it.
    • ❌ Endpoints
      • ✔️ App
      • ✔️ User
      • ❌ Content
      • ❌ Forum
      • ❌ GroupV2
      • ❌ Tokens
      • ❌ Destiny2
      • ❌ CommunityContent
      • ❌ Trending
      • ❌ Fireteam
      • ❌ Social
      • ❌ Common
    • ❌ Entity Models
  • ✔️ Async and sync client implementations.

Quikstart

A simple synchronous usage example:

import bungie_api_python
from bungie_api_python.entities.core import OAuthClientType

# Anything beyond the api key is optional,
# and only required for endpoints that use OAuth
client = bungie_api_python.BungieClientSync(
  api_key='your_key',
  client_id=000,
  client_secret='client_secret',
  client_type=OAuthClientType.Confidential
)

# Non OAuth endpoints will work right away
apps = client.app.get_bungie_applications()
for app in apps.Response:
  print(f'{app.name}: {app.status}')
# >>> www.bungie.net: ApplicationStatus.Private
# >>> Destiny 2 Companion (Android): ApplicationStatus.Private
# etc...

# If using OAuth, passing in an authorization code will perform the token
# exchange process, and refresh the token as necessary.
client.gen_oauth_context(code='your auth code')

user = client.user.get_membership_data_for_current_user()
print(user.Response.bungieNetUser.uniqueName)
# >>> "Aryathel#7877"

The same process can be used for an asynchronous client. Simply create a BungieClientAsync instance rather than a BungeClientSync instance, then await your calls (await client.gen_oauth_context, await client.user.get_bungie_applications, etc.).

Endpoints

All endpoint methods are accessed via the respective client.

client = BungieClientSync(...) then client.<collection>.<method>

client.oauth.get_access_token

OAuth Endpoints

Endpoint Method Implemented Tested Comments
GetAccessToken oauth.get_access_token ✔️ ✔️
GetRefreshToken oauth.refresh_access_token ✔️ ✔️

App Endpoints

Endpoint Implemented Tested Comments
GetApplicationApiUsage ✔️ ✔️
GetBungieApplications ✔️ ✔️

User Endpoints

Endpoint Implemented Tested Comments
GetBungieNetUserById ✔️ ✔️
GetSanitizedPlatformDisplayNames ✔️ ✔️
GetCredentialTypesForTargetAccount ✔️ ✔️
GetAvailableThemes ✔️ ✔️
GetMembershipDataById ✔️ ✔️
GetMembershipDataForCurrentUser ✔️ ✔️
GetMembershipFromHardLinkedCredential ✔️ ✔️
SearchByGlobalNamePrefix This endpoint is obsolete and will raise an error if called, it is only included for posterity's sake.
SearchByGlobalNamePost ✔️ ✔️

Content Endpoints

Endpoint Implemented Tested Comments
GetContentType
GetContentById
GetContentByTagAndType
SearchContentWithText
SearchContentByTagAndType
SearchHelpArticles
RssNewsArticles

Forum Endpoints

Endpoint Implemented Tested Comments
GetTopicsPaged
GetCoreTopicsPaged
GetPostsThreadedPaged
GetPostsThreadedPagedFromChild
GetPostAndParent
GetPostAndParentAwaitingApproval
GetTopicForContent
GetForumTagSuggestions
GetPoll
GetRecruitmentThreadSummaries

GroupV2 Endpoints

Endpoint Implemented Tested Comments
GetAvailableAvatars
GetAvailableThemes
GetUserClanInviteSetting
GetRecommendedGroups
GroupSearch
GetGroup
GetGroupByName
GetGroupByNameV2
GetGroupOptionalConversations
EditGroup
EditClanBanner
EditFounderOptions
AddOptionalConversation
EditOptionalConversation
GetMembersOfGroup
GetAdminsAndFounderOfGroup
EditGroupMembership
KickMember
BanMember
UnbanMember
GetBannedMembersOfGroup
AbdicateFoundership
GetPendingMemberships
GetInvitedIndividuals
ApproveAllPending
DenyAllPending
ApprovePendingForList
ApprovePending
DenyPendingForList
GetGroupsForMember
RecoverGroupForFounder
GetPotentialGroupsForMember
IndividualGroupInvite
IndividualGroupInviteCancel

Tokens Endpoints

Endpoint Implemented Tested Comments
ForceDropsRepair
ClaimPartnerOffer
ApplyMissingPartnerOffersWithoutClaim
GetPartnerOfferSkuHistory
GetPartnerRewardHistory
GetBungieRewardsForUser
GetBungieRewardsForPlatformUser
GetBungieRewardsList

Destiny2 Endpoints

Endpoint Implemented Tested Comments
GetDestinyManifest
GetDestinyEntityDefinition
SearchDestinyPlayerByBungieName
GetLinkedProfiles
GetProfile
GetCharacter
GetClanWeeklyRewardState
GetClanBannerSource
GetItem
GetVendors
GetVendor
GetPublicVendors
GetCollectibleNodeDetails
TransferItem
PullFromPostmaster
EquipItem
EquipItems
SetItemLockState
SetQuestTrackedState
InsertSocketPlug
InsertSocketPlugFree
GetPostGameCarnageReport
ReportOffensivePostGameCarnageReportPlayer
GetHistoricalStatsDefinition
GetClanLeaderboards
GetClanAggregateStats
GetLeaderboards
GetLeaderboardsForCharacter
SearchDestinyEntities
GetHistoricalStats
GetHistoricalStatsForAccount
GetActivityHistory
GetUniqueWeaponHistory
GetDestinyAggregateActivityStats
GetPublicMilestoneContent
GetPublicMilestones
AwaInitializeRequest
AwaProvideAuthorizationResult
AwaGetActionToken

CommunityContent Endpoint

Endpoint Implemented Tested Comments
GetCommunityContent

Trending Endpoints

Endpoint Implemented Tested Comments
GetTrendingCategories
GetTrendingCategory
GetTrendingEntryDetail

Fireteam Endpoints

Endpoint Implemented Tested Comments
GetActivePrivateClanFireteamCount
GetAvailableClanFireteams
SearchPublicAvailableClanFireteams
GetMyClanFireteams
GetClanFireteam

Social Endpoints

Endpoint Implemented Tested Comments
GetFriendList
GetFriendRequestList
IssueFriendRequest
AcceptFriendRequest
DeclineFriendRequest
RemoveFriend
RemoveFriendRequest
GetPlatformFriendList

Core Endpoints

Endpoint Implemented Tested Comments
GetAvailableLocales
GetCommonSettings
GetUserSystemOverrides
GetGlobalAlerts

Notes

  • I plan to create a separate package specifically for integrating with the Destiny manifest, which will utilize this package as a dependency.