blizzardapi2 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,325 @@
1
+ """wow_profile_api.py file."""
2
+ from ..api import Api
3
+
4
+
5
+ class WowProfileApi(Api):
6
+ """All Wow Profile API methods.
7
+
8
+ Attributes:
9
+ client_id: A string client id supplied by Blizzard.
10
+ client_secret: A string client secret supplied by Blizzard.
11
+ """
12
+
13
+ def __init__(self, client_id, client_secret):
14
+ """Init WowProfileApi."""
15
+ super().__init__(client_id, client_secret)
16
+
17
+ # Account Profile API
18
+
19
+ def get_account_profile_summary(self, region, locale, access_token):
20
+ """Return a profile summary for an account."""
21
+ resource = "/profile/user/wow"
22
+ query_params = {
23
+ "namespace": f"profile-{region}",
24
+ "locale": locale,
25
+ "access_token": access_token,
26
+ }
27
+ return super().get_resource(resource, region, query_params)
28
+
29
+ def get_protected_character_profile_summary(
30
+ self, region, locale, access_token, realm_id, character_id
31
+ ):
32
+ """Return a protected profile summary for a character."""
33
+ resource = f"/profile/user/wow/protected-character/{realm_id}-{character_id}"
34
+ query_params = {
35
+ "namespace": f"profile-{region}",
36
+ "locale": locale,
37
+ "access_token": access_token,
38
+ }
39
+ return super().get_resource(resource, region, query_params)
40
+
41
+ def get_account_collections_index(self, region, locale, access_token):
42
+ """Return an index of collection types for an account."""
43
+ resource = "/profile/user/wow/collections"
44
+ query_params = {
45
+ "namespace": f"profile-{region}",
46
+ "locale": locale,
47
+ "access_token": access_token,
48
+ }
49
+ return super().get_resource(resource, region, query_params)
50
+
51
+ def get_account_mounts_collection_summary(self, region, locale, access_token):
52
+ """Return a summary of the mounts an account has obtained."""
53
+ resource = "/profile/user/wow/collections/mounts"
54
+ query_params = {
55
+ "namespace": f"profile-{region}",
56
+ "locale": locale,
57
+ "access_token": access_token,
58
+ }
59
+ return super().get_resource(resource, region, query_params)
60
+
61
+ def get_account_pets_collection_summary(self, region, locale, access_token):
62
+ """Return a summary of the battle pets an account has obtained."""
63
+ resource = "/profile/user/wow/collections/pets"
64
+ query_params = {
65
+ "namespace": f"profile-{region}",
66
+ "locale": locale,
67
+ "access_token": access_token,
68
+ }
69
+ return super().get_resource(resource, region, query_params)
70
+
71
+ # Character Achievements API
72
+
73
+ def get_character_achievements_summary(
74
+ self, region, locale, realm_slug, character_name
75
+ ):
76
+ """Return a summary of the achievements a character has completed."""
77
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/achievements"
78
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
79
+ return super().get_resource(resource, region, query_params)
80
+
81
+ def get_character_achievement_statistics(
82
+ self, region, locale, realm_slug, character_name
83
+ ):
84
+ """Return a character's statistics as they pertain to achievements."""
85
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/achievements/statistics"
86
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
87
+ return super().get_resource(resource, region, query_params)
88
+
89
+ # Character Appearance API
90
+
91
+ def get_character_appearance_summary(
92
+ self, region, locale, realm_slug, character_name
93
+ ):
94
+ """Return a summary of a character's appearance settings."""
95
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/appearance"
96
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
97
+ return super().get_resource(resource, region, query_params)
98
+
99
+ # Character Collections API
100
+
101
+ def get_character_collections_index(
102
+ self, region, locale, realm_slug, character_name
103
+ ):
104
+ """Return an index of collection types for a character."""
105
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/collections"
106
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
107
+ return super().get_resource(resource, region, query_params)
108
+
109
+ def get_character_mounts_collection_index(
110
+ self, region, locale, realm_slug, character_name
111
+ ):
112
+ """Return a summary of the mounts a character has obtained."""
113
+ resource = (
114
+ f"/profile/wow/character/{realm_slug}/{character_name}/collections/mounts"
115
+ )
116
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
117
+ return super().get_resource(resource, region, query_params)
118
+
119
+ def get_character_pets_collection_index(
120
+ self, region, locale, realm_slug, character_name
121
+ ):
122
+ """Return a summary of the battle pets a character has obtained."""
123
+ resource = (
124
+ f"/profile/wow/character/{realm_slug}/{character_name}/collections/pets"
125
+ )
126
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
127
+ return super().get_resource(resource, region, query_params)
128
+
129
+ # Character Encounters API
130
+
131
+ def get_character_encounters_summary(
132
+ self, region, locale, realm_slug, character_name
133
+ ):
134
+ """Return a summary of a character's encounters."""
135
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/encounters"
136
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
137
+ return super().get_resource(resource, region, query_params)
138
+
139
+ def get_character_dungeons(self, region, locale, realm_slug, character_name):
140
+ """Return a summary of a character's completed dungeons."""
141
+ resource = (
142
+ f"/profile/wow/character/{realm_slug}/{character_name}/encounters/dungeons"
143
+ )
144
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
145
+ return super().get_resource(resource, region, query_params)
146
+
147
+ def get_character_raids(self, region, locale, realm_slug, character_name):
148
+ """Return a summary of a character's completed raids."""
149
+ resource = (
150
+ f"/profile/wow/character/{realm_slug}/{character_name}/encounters/raids"
151
+ )
152
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
153
+ return super().get_resource(resource, region, query_params)
154
+
155
+ # Character Equipment API
156
+
157
+ def get_character_equipment_summary(
158
+ self, region, locale, realm_slug, character_name
159
+ ):
160
+ """Return a summary of the items equipped by a character."""
161
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/equipment"
162
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
163
+ return super().get_resource(resource, region, query_params)
164
+
165
+ # Character Hunter Pets API
166
+
167
+ def get_character_hunter_pets_summary(
168
+ self, region, locale, realm_slug, character_name
169
+ ):
170
+ """If the character is a hunter, returns a summary of the character's hunter pets."""
171
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/hunter-pets"
172
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
173
+ return super().get_resource(resource, region, query_params)
174
+
175
+ # Character Media API
176
+
177
+ def get_character_media_summary(self, region, locale, realm_slug, character_name):
178
+ """Return a summary of the media assets available for a character (such as an avatar render)."""
179
+ resource = (
180
+ f"/profile/wow/character/{realm_slug}/{character_name}/character-media"
181
+ )
182
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
183
+ return super().get_resource(resource, region, query_params)
184
+
185
+ # Character Mythic Keystone Profile API
186
+
187
+ def get_character_mythic_keystone_profile_index(
188
+ self, region, locale, realm_slug, character_name
189
+ ):
190
+ """Return the Mythic Keystone profile index for a character."""
191
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/mythic-keystone-profile"
192
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
193
+ return super().get_resource(resource, region, query_params)
194
+
195
+ def get_character_mythic_keystone_profile_season_details(
196
+ self, region, locale, realm_slug, character_name, season_id
197
+ ):
198
+ """Return the Mythic Keystone season details for a character."""
199
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/mythic-keystone-profile/season/{season_id}"
200
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
201
+ return super().get_resource(resource, region, query_params)
202
+
203
+ # Character Professions API
204
+
205
+ def get_character_professions_summary(
206
+ self, region, locale, realm_slug, character_name
207
+ ):
208
+ """Return a summary of professions for a character."""
209
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/professions"
210
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
211
+ return super().get_resource(resource, region, query_params)
212
+
213
+ # Character Profile API
214
+
215
+ def get_character_profile_summary(self, region, locale, realm_slug, character_name):
216
+ """Return a profile summary for a character."""
217
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}"
218
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
219
+ return super().get_resource(resource, region, query_params)
220
+
221
+ def get_character_profile_status(self, region, locale, realm_slug, character_name):
222
+ """Return the status and a unique ID for a character."""
223
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/status"
224
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
225
+ return super().get_resource(resource, region, query_params)
226
+
227
+ # Character Pvp API
228
+
229
+ def get_character_pvp_bracket_statistics(
230
+ self, region, locale, realm_slug, character_name, pvp_bracket
231
+ ):
232
+ """Return the Pvp bracket statistics for a character."""
233
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/pvp-bracket/{pvp_bracket}"
234
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
235
+ return super().get_resource(resource, region, query_params)
236
+
237
+ def get_character_pvp_summary(self, region, locale, realm_slug, character_name):
238
+ """Return a Pvp summary for a character."""
239
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/pvp-summary"
240
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
241
+ return super().get_resource(resource, region, query_params)
242
+
243
+ # Character Quests API
244
+
245
+ def get_character_quests(self, region, locale, realm_slug, character_name):
246
+ """Return a character's active quests as well as a link to the character's completed quests."""
247
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/quests"
248
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
249
+ return super().get_resource(resource, region, query_params)
250
+
251
+ def get_character_completed_quests(
252
+ self, region, locale, realm_slug, character_name
253
+ ):
254
+ """Return a list of quests that a character has completed."""
255
+ resource = (
256
+ f"/profile/wow/character/{realm_slug}/{character_name}/quests/completed"
257
+ )
258
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
259
+ return super().get_resource(resource, region, query_params)
260
+
261
+ # Character Reputations API
262
+
263
+ def get_character_reputations_summary(
264
+ self, region, locale, realm_slug, character_name
265
+ ):
266
+ """Return a summary of a character's reputations."""
267
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/reputations"
268
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
269
+ return super().get_resource(resource, region, query_params)
270
+
271
+ # Character Specializations API
272
+
273
+ def get_character_specializations_summary(
274
+ self, region, locale, realm_slug, character_name
275
+ ):
276
+ """Return a summary of a character's specializations."""
277
+ resource = (
278
+ f"/profile/wow/character/{realm_slug}/{character_name}/specializations"
279
+ )
280
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
281
+ return super().get_resource(resource, region, query_params)
282
+
283
+ # Character Statistics API
284
+
285
+ def get_character_statistics_summary(
286
+ self, region, locale, realm_slug, character_name
287
+ ):
288
+ """Return a statistics summary for a character."""
289
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/statistics"
290
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
291
+ return super().get_resource(resource, region, query_params)
292
+
293
+ # Character Titles API
294
+
295
+ def get_character_titles_summary(self, region, locale, realm_slug, character_name):
296
+ """Return a summary of titles a character has obtained."""
297
+ resource = f"/profile/wow/character/{realm_slug}/{character_name}/titles"
298
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
299
+ return super().get_resource(resource, region, query_params)
300
+
301
+ # Guild API
302
+
303
+ def get_guild(self, region, locale, realm_slug, name_slug):
304
+ """Return a single guild by its name and realm."""
305
+ resource = f"/data/wow/guild/{realm_slug}/{name_slug}"
306
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
307
+ return super().get_resource(resource, region, query_params)
308
+
309
+ def get_guild_activity(self, region, locale, realm_slug, name_slug):
310
+ """Return a single guild's activity by name and realm."""
311
+ resource = f"/data/wow/guild/{realm_slug}/{name_slug}/activity"
312
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
313
+ return super().get_resource(resource, region, query_params)
314
+
315
+ def get_guild_achievements(self, region, locale, realm_slug, name_slug):
316
+ """Return a single guild's achievements by name and realm."""
317
+ resource = f"/data/wow/guild/{realm_slug}/{name_slug}/achievements"
318
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
319
+ return super().get_resource(resource, region, query_params)
320
+
321
+ def get_guild_roster(self, region, locale, realm_slug, name_slug):
322
+ """Return a single guild's roster by its name and realm."""
323
+ resource = f"/data/wow/guild/{realm_slug}/{name_slug}/roster"
324
+ query_params = {"namespace": f"profile-{region}", "locale": locale}
325
+ return super().get_resource(resource, region, query_params)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Trevor Phillips
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,79 @@
1
+ Metadata-Version: 2.1
2
+ Name: blizzardapi2
3
+ Version: 0.1.0
4
+ Summary: A Python wrapper for Blizzard API
5
+ License: MIT
6
+ Author: Your Name
7
+ Author-email: you@example.com
8
+ Requires-Python: >=3.11,<4.0
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Requires-Dist: black (>=24.4.2,<25.0.0)
14
+ Requires-Dist: pytest (>=8.2.2,<9.0.0)
15
+ Requires-Dist: requests (>=2.32.3,<3.0.0)
16
+ Description-Content-Type: text/markdown
17
+
18
+ # python-blizzardapi2
19
+ ![GitHub](https://img.shields.io/github/license/lostcol0ny/python-blizzardapi2)
20
+
21
+ python-blizzardapi2 is a client library for Blizzard's APIs. It's a fork of [the original library](https://github.com/trevorphillipscoding/python-blizzardapi/) and I'm trying to update it and keep its packages managed.
22
+
23
+ Current supported features include:
24
+ - Battle.net User
25
+ - Wow Profile
26
+ - Wow Game Data
27
+ - Wow Classic Game Data
28
+ - Diablo 3 Community
29
+ - Diablo 3 Game Data
30
+ - Hearthstone Game Data
31
+
32
+ To gain access to Blizzard's API please register [here](https://develop.battle.net/access/) to obtain a client id and client secret.
33
+
34
+ For more information on Blizzard's API visit:
35
+
36
+ [Official Documentation](https://develop.battle.net/documentation)
37
+ [Official API Forum](https://us.forums.blizzard.com/en/blizzard/c/api-discussion)
38
+
39
+ # Requirements
40
+
41
+ Python (3.9, 3.10, 3.11)
42
+
43
+ # Installing
44
+
45
+ `pip install python-blizzardapi2`
46
+
47
+ # Example
48
+
49
+ **main.py**
50
+ ```python
51
+ from blizzardapi2 import BlizzardApi
52
+
53
+ api_client = BlizzardApi("client_id", "client_secret")
54
+
55
+ # Unprotected API endpoint
56
+ categories_index = api_client.wow.game_data.get_achievement_categories_index("us", "en_US")
57
+
58
+ # Protected API endpoint
59
+ summary = api_client.wow.profile.get_account_profile_summary("us", "en_US", "access_token")
60
+
61
+ # Wow Classic endpoint
62
+ connected_realms_index = api_client.wow.game_data.get_connected_realms_index("us", "en_US", is_classic=True)
63
+ ```
64
+
65
+ # Access token vs Client ID/Client Secret
66
+
67
+ You can pass in a `client_id` and `client_secret` and use almost any endpoint except for a few that require an `access_token` obtained via OAuth authorization code flow. You can find more information at https://develop.battle.net/documentation/guides/using-oauth/authorization-code-flow.
68
+
69
+ Here is the list of endpoints, specified by Blizzard, that require an OAuth token.
70
+
71
+ ```
72
+ GET /oauth/userinfo
73
+ GET /profile/user/wow
74
+ GET /profile/user/wow/protected-character/{realm-id}-{character-id}
75
+ GET /profile/user/wow/collections
76
+ GET /profile/user/wow/collections/pets
77
+ GET /profile/user/wow/collections/mounts
78
+ ```
79
+
@@ -0,0 +1,21 @@
1
+ blizzardapi2/__init__.py,sha256=P2lwM4PifHuNOI_w5hB3HbsCXZ0qiTh7jZI9LvoZx2s,117
2
+ blizzardapi2/api.py,sha256=j8Mrf7qq_b2ye5ScxcI4sNxK8YTQNNJc10xnS97KbO8,3389
3
+ blizzardapi2/battlenet/__init__.py,sha256=bo5HGfVmpDQn8VxVnFmMiDEBu04d8bFsRtzyysFJ83s,25
4
+ blizzardapi2/battlenet/battlenet_api.py,sha256=-X90oU_6XSSDGBg-7EKHEILp06AZ-cmxEkA1I5nvimk,448
5
+ blizzardapi2/battlenet/battlenet_oauth_api.py,sha256=dq9d9e3teKYTobaCcMnD544EEv8pnfxY7S4me-6h91s,811
6
+ blizzardapi2/blizzard_api.py,sha256=QyqCm_WO4h0sO8GRluF3so9Cpi_t677Y4QyPqTHtaio,759
7
+ blizzardapi2/diablo3/__init__.py,sha256=bo5HGfVmpDQn8VxVnFmMiDEBu04d8bFsRtzyysFJ83s,25
8
+ blizzardapi2/diablo3/diablo3_api.py,sha256=EVItrO1ph1vUEkI-MyOlLdag0YCVHcGvzdtMTQBlzz0,575
9
+ blizzardapi2/diablo3/diablo3_community_api.py,sha256=h_l1ltdsLU_VFFj4VjW8qbo91vyAm3by5s08rOqjkEQ,4657
10
+ blizzardapi2/diablo3/diablo3_game_data_api.py,sha256=7DAzipRp7mR4SRWBnX8gHNdnjLLD8ejq7AZwrM8ffVc,1810
11
+ blizzardapi2/hearthstone/__init__.py,sha256=bo5HGfVmpDQn8VxVnFmMiDEBu04d8bFsRtzyysFJ83s,25
12
+ blizzardapi2/hearthstone/hearthstone_api.py,sha256=o1ny3ZWtLeo9uEvIM87o7wFVAwEPLRI87uHkS59dorI,475
13
+ blizzardapi2/hearthstone/hearthstone_game_data_api.py,sha256=h-3Gca6k16XRFYaqtxOB137zMgsiWGQq1RpVGrmJggs,2664
14
+ blizzardapi2/wow/__init__.py,sha256=bo5HGfVmpDQn8VxVnFmMiDEBu04d8bFsRtzyysFJ83s,25
15
+ blizzardapi2/wow/wow_api.py,sha256=ZSRjo7bhtD7jw6l9-ofjxFoXaKXy_3p6Xdn5bGVdJmE,527
16
+ blizzardapi2/wow/wow_game_data_api.py,sha256=RoCQdz3dC3vHjW88SeQY9d1flDQH2G3J1ES7LTmKFEs,41429
17
+ blizzardapi2/wow/wow_profile_api.py,sha256=fMaYaE6-73z0izfGB_RCVJTA3_4poLWZrWO6rxBqFHw,15237
18
+ blizzardapi2-0.1.0.dist-info/LICENSE,sha256=qLR0w_3KBPmwUrlmkRmjKOqrQX6U6sS2gZs9Eu-_lTk,1093
19
+ blizzardapi2-0.1.0.dist-info/METADATA,sha256=MI8cviVKsUnP9Fa2_cab6K0L3KaWQWoLCGuizhzoKI8,2629
20
+ blizzardapi2-0.1.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
21
+ blizzardapi2-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 1.9.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any