Skip to content

User HTTP Routes

UserRouteHttpRequests

Source code in src/bungio/http/routes/user.py
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
class UserRouteHttpRequests:
    request: Callable[..., Coroutine]

    async def get_bungie_net_user_by_id(self, id: int, auth: Optional[AuthData] = None, *args, **kwargs) -> dict:
        """
        Loads a bungienet user by membership id.

        Args:
            id: The requested Bungie.net membership id.
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Raises:
            NotFound: 404 request
            BadRequest: 400 request
            InvalidAuthentication: If authentication is invalid
            TimeoutException: If no connection could be made
            BungieDead: Servers are down
            AuthenticationTooSlow: The authentication key has expired
            BungieException: Relaying the bungie error

        Returns:
            The json response
        """

        return await self.request(Route(path=f"/User/GetBungieNetUserById/{id}/", method="GET", auth=auth))

    async def get_sanitized_platform_display_names(
        self, membership_id: int, auth: Optional[AuthData] = None, *args, **kwargs
    ) -> dict:
        """
        Gets a list of all display names linked to this membership id but sanitized (profanity filtered). Obeys all visibility rules of calling user and is heavily cached.

        Args:
            membership_id: The requested membership id to load.
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Raises:
            NotFound: 404 request
            BadRequest: 400 request
            InvalidAuthentication: If authentication is invalid
            TimeoutException: If no connection could be made
            BungieDead: Servers are down
            AuthenticationTooSlow: The authentication key has expired
            BungieException: Relaying the bungie error

        Returns:
            The json response
        """

        return await self.request(
            Route(path=f"/User/GetSanitizedPlatformDisplayNames/{membership_id}/", method="GET", auth=auth)
        )

    async def get_credential_types_for_target_account(
        self, membership_id: int, auth: Optional[AuthData] = None, *args, **kwargs
    ) -> dict:
        """
        Returns a list of credential types attached to the requested account

        Args:
            membership_id: The user's membership id
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Raises:
            NotFound: 404 request
            BadRequest: 400 request
            InvalidAuthentication: If authentication is invalid
            TimeoutException: If no connection could be made
            BungieDead: Servers are down
            AuthenticationTooSlow: The authentication key has expired
            BungieException: Relaying the bungie error

        Returns:
            The json response
        """

        return await self.request(
            Route(path=f"/User/GetCredentialTypesForTargetAccount/{membership_id}/", method="GET", auth=auth)
        )

    async def get_available_themes(self, auth: Optional[AuthData] = None, *args, **kwargs) -> dict:
        """
        Returns a list of all available user themes.

        Args:
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Raises:
            NotFound: 404 request
            BadRequest: 400 request
            InvalidAuthentication: If authentication is invalid
            TimeoutException: If no connection could be made
            BungieDead: Servers are down
            AuthenticationTooSlow: The authentication key has expired
            BungieException: Relaying the bungie error

        Returns:
            The json response
        """

        return await self.request(Route(path="/User/GetAvailableThemes/", method="GET", auth=auth))

    async def get_membership_data_by_id(
        self, membership_id: int, membership_type: int, auth: Optional[AuthData] = None, *args, **kwargs
    ) -> dict:
        """
        Returns a list of accounts associated with the supplied membership ID and membership type. This will include all linked accounts (even when hidden) if supplied credentials permit it.

        Args:
            membership_id: The membership ID of the target user.
            membership_type: Type of the supplied membership ID.
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Raises:
            NotFound: 404 request
            BadRequest: 400 request
            InvalidAuthentication: If authentication is invalid
            TimeoutException: If no connection could be made
            BungieDead: Servers are down
            AuthenticationTooSlow: The authentication key has expired
            BungieException: Relaying the bungie error

        Returns:
            The json response
        """

        return await self.request(
            Route(path=f"/User/GetMembershipsById/{membership_id}/{membership_type}/", method="GET", auth=auth)
        )

    async def get_membership_data_for_current_user(self, auth: AuthData, *args, **kwargs) -> dict:
        """
        Returns a list of accounts associated with signed in user. This is useful for OAuth implementations that do not give you access to the token response.

        Warning: Requires Authentication.
            Required oauth2 scopes: ReadBasicUserProfile

        Args:
            auth: Authentication information.

        Raises:
            NotFound: 404 request
            BadRequest: 400 request
            InvalidAuthentication: If authentication is invalid
            TimeoutException: If no connection could be made
            BungieDead: Servers are down
            AuthenticationTooSlow: The authentication key has expired
            BungieException: Relaying the bungie error

        Returns:
            The json response
        """

        return await self.request(Route(path="/User/GetMembershipsForCurrentUser/", method="GET", auth=auth))

    async def get_membership_from_hard_linked_credential(
        self, credential: str, cr_type: int, auth: Optional[AuthData] = None, *args, **kwargs
    ) -> dict:
        """
        Gets any hard linked membership given a credential. Only works for credentials that are public (just SteamID64 right now). Cross Save aware.

        Args:
            credential: The credential to look up. Must be a valid SteamID64.
            cr_type: The credential type. 'SteamId' is the only valid value at present.
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Raises:
            NotFound: 404 request
            BadRequest: 400 request
            InvalidAuthentication: If authentication is invalid
            TimeoutException: If no connection could be made
            BungieDead: Servers are down
            AuthenticationTooSlow: The authentication key has expired
            BungieException: Relaying the bungie error

        Returns:
            The json response
        """

        return await self.request(
            Route(path=f"/User/GetMembershipFromHardLinkedCredential/{cr_type}/{credential}/", method="GET", auth=auth)
        )

    async def search_by_global_name_prefix(
        self, display_name_prefix: str, page: int, auth: Optional[AuthData] = None, *args, **kwargs
    ) -> dict:
        """
        [OBSOLETE] Do not use this to search users, use SearchByGlobalNamePost instead.

        Args:
            display_name_prefix: The display name prefix you're looking for.
            page: The zero-based page of results you desire.
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Raises:
            NotFound: 404 request
            BadRequest: 400 request
            InvalidAuthentication: If authentication is invalid
            TimeoutException: If no connection could be made
            BungieDead: Servers are down
            AuthenticationTooSlow: The authentication key has expired
            BungieException: Relaying the bungie error

        Returns:
            The json response
        """

        return await self.request(
            Route(path=f"/User/Search/Prefix/{display_name_prefix}/{page}/", method="GET", auth=auth)
        )

    async def search_by_global_name_post(
        self, display_name_prefix: str, page: int, auth: Optional[AuthData] = None, *args, **kwargs
    ) -> dict:
        """
        Given the prefix of a global display name, returns all users who share that name.

        Args:
            display_name_prefix: _No description given by bungie._
            page: The zero-based page of results you desire.
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Raises:
            NotFound: 404 request
            BadRequest: 400 request
            InvalidAuthentication: If authentication is invalid
            TimeoutException: If no connection could be made
            BungieDead: Servers are down
            AuthenticationTooSlow: The authentication key has expired
            BungieException: Relaying the bungie error

        Returns:
            The json response
        """

        data = {
            "displayNamePrefix": display_name_prefix,
        }

        return await self.request(Route(path=f"/User/Search/GlobalName/{page}/", method="POST", data=data, auth=auth))

get_available_themes(auth=None, *args, **kwargs) async

Returns a list of all available user themes.

Parameters:

Name Type Description Default
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Raises:

Type Description
NotFound

404 request

BadRequest

400 request

InvalidAuthentication

If authentication is invalid

TimeoutException

If no connection could be made

BungieDead

Servers are down

AuthenticationTooSlow

The authentication key has expired

BungieException

Relaying the bungie error

Returns:

Type Description
dict

The json response

Source code in src/bungio/http/routes/user.py
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
async def get_available_themes(self, auth: Optional[AuthData] = None, *args, **kwargs) -> dict:
    """
    Returns a list of all available user themes.

    Args:
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Raises:
        NotFound: 404 request
        BadRequest: 400 request
        InvalidAuthentication: If authentication is invalid
        TimeoutException: If no connection could be made
        BungieDead: Servers are down
        AuthenticationTooSlow: The authentication key has expired
        BungieException: Relaying the bungie error

    Returns:
        The json response
    """

    return await self.request(Route(path="/User/GetAvailableThemes/", method="GET", auth=auth))

get_bungie_net_user_by_id(id, auth=None, *args, **kwargs) async

Loads a bungienet user by membership id.

Parameters:

Name Type Description Default
id int

The requested Bungie.net membership id.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Raises:

Type Description
NotFound

404 request

BadRequest

400 request

InvalidAuthentication

If authentication is invalid

TimeoutException

If no connection could be made

BungieDead

Servers are down

AuthenticationTooSlow

The authentication key has expired

BungieException

Relaying the bungie error

Returns:

Type Description
dict

The json response

Source code in src/bungio/http/routes/user.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
async def get_bungie_net_user_by_id(self, id: int, auth: Optional[AuthData] = None, *args, **kwargs) -> dict:
    """
    Loads a bungienet user by membership id.

    Args:
        id: The requested Bungie.net membership id.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Raises:
        NotFound: 404 request
        BadRequest: 400 request
        InvalidAuthentication: If authentication is invalid
        TimeoutException: If no connection could be made
        BungieDead: Servers are down
        AuthenticationTooSlow: The authentication key has expired
        BungieException: Relaying the bungie error

    Returns:
        The json response
    """

    return await self.request(Route(path=f"/User/GetBungieNetUserById/{id}/", method="GET", auth=auth))

get_credential_types_for_target_account(membership_id, auth=None, *args, **kwargs) async

Returns a list of credential types attached to the requested account

Parameters:

Name Type Description Default
membership_id int

The user's membership id

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Raises:

Type Description
NotFound

404 request

BadRequest

400 request

InvalidAuthentication

If authentication is invalid

TimeoutException

If no connection could be made

BungieDead

Servers are down

AuthenticationTooSlow

The authentication key has expired

BungieException

Relaying the bungie error

Returns:

Type Description
dict

The json response

Source code in src/bungio/http/routes/user.py
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
async def get_credential_types_for_target_account(
    self, membership_id: int, auth: Optional[AuthData] = None, *args, **kwargs
) -> dict:
    """
    Returns a list of credential types attached to the requested account

    Args:
        membership_id: The user's membership id
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Raises:
        NotFound: 404 request
        BadRequest: 400 request
        InvalidAuthentication: If authentication is invalid
        TimeoutException: If no connection could be made
        BungieDead: Servers are down
        AuthenticationTooSlow: The authentication key has expired
        BungieException: Relaying the bungie error

    Returns:
        The json response
    """

    return await self.request(
        Route(path=f"/User/GetCredentialTypesForTargetAccount/{membership_id}/", method="GET", auth=auth)
    )

get_membership_data_by_id(membership_id, membership_type, auth=None, *args, **kwargs) async

Returns a list of accounts associated with the supplied membership ID and membership type. This will include all linked accounts (even when hidden) if supplied credentials permit it.

Parameters:

Name Type Description Default
membership_id int

The membership ID of the target user.

required
membership_type int

Type of the supplied membership ID.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Raises:

Type Description
NotFound

404 request

BadRequest

400 request

InvalidAuthentication

If authentication is invalid

TimeoutException

If no connection could be made

BungieDead

Servers are down

AuthenticationTooSlow

The authentication key has expired

BungieException

Relaying the bungie error

Returns:

Type Description
dict

The json response

Source code in src/bungio/http/routes/user.py
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
async def get_membership_data_by_id(
    self, membership_id: int, membership_type: int, auth: Optional[AuthData] = None, *args, **kwargs
) -> dict:
    """
    Returns a list of accounts associated with the supplied membership ID and membership type. This will include all linked accounts (even when hidden) if supplied credentials permit it.

    Args:
        membership_id: The membership ID of the target user.
        membership_type: Type of the supplied membership ID.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Raises:
        NotFound: 404 request
        BadRequest: 400 request
        InvalidAuthentication: If authentication is invalid
        TimeoutException: If no connection could be made
        BungieDead: Servers are down
        AuthenticationTooSlow: The authentication key has expired
        BungieException: Relaying the bungie error

    Returns:
        The json response
    """

    return await self.request(
        Route(path=f"/User/GetMembershipsById/{membership_id}/{membership_type}/", method="GET", auth=auth)
    )

get_membership_data_for_current_user(auth, *args, **kwargs) async

Returns a list of accounts associated with signed in user. This is useful for OAuth implementations that do not give you access to the token response.

Requires Authentication.

Required oauth2 scopes: ReadBasicUserProfile

Parameters:

Name Type Description Default
auth AuthData

Authentication information.

required

Raises:

Type Description
NotFound

404 request

BadRequest

400 request

InvalidAuthentication

If authentication is invalid

TimeoutException

If no connection could be made

BungieDead

Servers are down

AuthenticationTooSlow

The authentication key has expired

BungieException

Relaying the bungie error

Returns:

Type Description
dict

The json response

Source code in src/bungio/http/routes/user.py
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
async def get_membership_data_for_current_user(self, auth: AuthData, *args, **kwargs) -> dict:
    """
    Returns a list of accounts associated with signed in user. This is useful for OAuth implementations that do not give you access to the token response.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadBasicUserProfile

    Args:
        auth: Authentication information.

    Raises:
        NotFound: 404 request
        BadRequest: 400 request
        InvalidAuthentication: If authentication is invalid
        TimeoutException: If no connection could be made
        BungieDead: Servers are down
        AuthenticationTooSlow: The authentication key has expired
        BungieException: Relaying the bungie error

    Returns:
        The json response
    """

    return await self.request(Route(path="/User/GetMembershipsForCurrentUser/", method="GET", auth=auth))

get_membership_from_hard_linked_credential(credential, cr_type, auth=None, *args, **kwargs) async

Gets any hard linked membership given a credential. Only works for credentials that are public (just SteamID64 right now). Cross Save aware.

Parameters:

Name Type Description Default
credential str

The credential to look up. Must be a valid SteamID64.

required
cr_type int

The credential type. 'SteamId' is the only valid value at present.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Raises:

Type Description
NotFound

404 request

BadRequest

400 request

InvalidAuthentication

If authentication is invalid

TimeoutException

If no connection could be made

BungieDead

Servers are down

AuthenticationTooSlow

The authentication key has expired

BungieException

Relaying the bungie error

Returns:

Type Description
dict

The json response

Source code in src/bungio/http/routes/user.py
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
async def get_membership_from_hard_linked_credential(
    self, credential: str, cr_type: int, auth: Optional[AuthData] = None, *args, **kwargs
) -> dict:
    """
    Gets any hard linked membership given a credential. Only works for credentials that are public (just SteamID64 right now). Cross Save aware.

    Args:
        credential: The credential to look up. Must be a valid SteamID64.
        cr_type: The credential type. 'SteamId' is the only valid value at present.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Raises:
        NotFound: 404 request
        BadRequest: 400 request
        InvalidAuthentication: If authentication is invalid
        TimeoutException: If no connection could be made
        BungieDead: Servers are down
        AuthenticationTooSlow: The authentication key has expired
        BungieException: Relaying the bungie error

    Returns:
        The json response
    """

    return await self.request(
        Route(path=f"/User/GetMembershipFromHardLinkedCredential/{cr_type}/{credential}/", method="GET", auth=auth)
    )

get_sanitized_platform_display_names(membership_id, auth=None, *args, **kwargs) async

Gets a list of all display names linked to this membership id but sanitized (profanity filtered). Obeys all visibility rules of calling user and is heavily cached.

Parameters:

Name Type Description Default
membership_id int

The requested membership id to load.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Raises:

Type Description
NotFound

404 request

BadRequest

400 request

InvalidAuthentication

If authentication is invalid

TimeoutException

If no connection could be made

BungieDead

Servers are down

AuthenticationTooSlow

The authentication key has expired

BungieException

Relaying the bungie error

Returns:

Type Description
dict

The json response

Source code in src/bungio/http/routes/user.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
async def get_sanitized_platform_display_names(
    self, membership_id: int, auth: Optional[AuthData] = None, *args, **kwargs
) -> dict:
    """
    Gets a list of all display names linked to this membership id but sanitized (profanity filtered). Obeys all visibility rules of calling user and is heavily cached.

    Args:
        membership_id: The requested membership id to load.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Raises:
        NotFound: 404 request
        BadRequest: 400 request
        InvalidAuthentication: If authentication is invalid
        TimeoutException: If no connection could be made
        BungieDead: Servers are down
        AuthenticationTooSlow: The authentication key has expired
        BungieException: Relaying the bungie error

    Returns:
        The json response
    """

    return await self.request(
        Route(path=f"/User/GetSanitizedPlatformDisplayNames/{membership_id}/", method="GET", auth=auth)
    )

search_by_global_name_post(display_name_prefix, page, auth=None, *args, **kwargs) async

Given the prefix of a global display name, returns all users who share that name.

Parameters:

Name Type Description Default
display_name_prefix str

No description given by bungie.

required
page int

The zero-based page of results you desire.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Raises:

Type Description
NotFound

404 request

BadRequest

400 request

InvalidAuthentication

If authentication is invalid

TimeoutException

If no connection could be made

BungieDead

Servers are down

AuthenticationTooSlow

The authentication key has expired

BungieException

Relaying the bungie error

Returns:

Type Description
dict

The json response

Source code in src/bungio/http/routes/user.py
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
async def search_by_global_name_post(
    self, display_name_prefix: str, page: int, auth: Optional[AuthData] = None, *args, **kwargs
) -> dict:
    """
    Given the prefix of a global display name, returns all users who share that name.

    Args:
        display_name_prefix: _No description given by bungie._
        page: The zero-based page of results you desire.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Raises:
        NotFound: 404 request
        BadRequest: 400 request
        InvalidAuthentication: If authentication is invalid
        TimeoutException: If no connection could be made
        BungieDead: Servers are down
        AuthenticationTooSlow: The authentication key has expired
        BungieException: Relaying the bungie error

    Returns:
        The json response
    """

    data = {
        "displayNamePrefix": display_name_prefix,
    }

    return await self.request(Route(path=f"/User/Search/GlobalName/{page}/", method="POST", data=data, auth=auth))

search_by_global_name_prefix(display_name_prefix, page, auth=None, *args, **kwargs) async

[OBSOLETE] Do not use this to search users, use SearchByGlobalNamePost instead.

Parameters:

Name Type Description Default
display_name_prefix str

The display name prefix you're looking for.

required
page int

The zero-based page of results you desire.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Raises:

Type Description
NotFound

404 request

BadRequest

400 request

InvalidAuthentication

If authentication is invalid

TimeoutException

If no connection could be made

BungieDead

Servers are down

AuthenticationTooSlow

The authentication key has expired

BungieException

Relaying the bungie error

Returns:

Type Description
dict

The json response

Source code in src/bungio/http/routes/user.py
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
async def search_by_global_name_prefix(
    self, display_name_prefix: str, page: int, auth: Optional[AuthData] = None, *args, **kwargs
) -> dict:
    """
    [OBSOLETE] Do not use this to search users, use SearchByGlobalNamePost instead.

    Args:
        display_name_prefix: The display name prefix you're looking for.
        page: The zero-based page of results you desire.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Raises:
        NotFound: 404 request
        BadRequest: 400 request
        InvalidAuthentication: If authentication is invalid
        TimeoutException: If no connection could be made
        BungieDead: Servers are down
        AuthenticationTooSlow: The authentication key has expired
        BungieException: Relaying the bungie error

    Returns:
        The json response
    """

    return await self.request(
        Route(path=f"/User/Search/Prefix/{display_name_prefix}/{page}/", method="GET", auth=auth)
    )