blizzardapi2 2.0.0__tar.gz → 2.0.2__tar.gz
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.
- blizzardapi2-2.0.2/.github/workflows/black.yml +13 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/.github/workflows/python-package.yml +36 -4
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/PKG-INFO +14 -3
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/README.md +7 -2
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/_version.py +2 -2
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/api.py +3 -3
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/blizzard_api.py +9 -10
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/diablo3/diablo3_community_api.py +12 -4
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/hearthstone/hearthstone_api.py +9 -3
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/hearthstone/hearthstone_game_data_api.py +12 -4
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/starcraft2/starcraft2_api.py +12 -2
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/starcraft2/starcraft2_community_api.py +60 -13
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/starcraft2/starcraft2_game_data_api.py +6 -1
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/types.py +4 -1
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/wow/wow_game_data_api.py +0 -1
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/wow/wow_profile_api.py +12 -4
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2.egg-info/PKG-INFO +14 -3
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2.egg-info/SOURCES.txt +1 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/pyproject.toml +10 -2
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/.github/dependabot.yml +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/.gitignore +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/CODE_OF_CONDUCT.md +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/CONTRIBUTING.md +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/LICENSE +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/SECURITY.md +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/__init__.py +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/battlenet/__init__.py +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/battlenet/battlenet_api.py +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/battlenet/battlenet_oauth_api.py +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/diablo3/__init__.py +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/diablo3/diablo3_api.py +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/diablo3/diablo3_game_data_api.py +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/hearthstone/__init__.py +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/starcraft2/__init__.py +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/wow/__init__.py +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/wow/wow_api.py +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2.egg-info/dependency_links.txt +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2.egg-info/requires.txt +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2.egg-info/top_level.txt +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/docs/battlenet/README.md +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/docs/diablo3/README.md +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/docs/hearthstone/README.md +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/docs/pull_request_template.md +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/docs/starcraft2/README.md +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/docs/wow/README.md +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/setup.cfg +0 -0
- {blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/uv.lock +0 -0
|
@@ -6,11 +6,9 @@ name: Python package
|
|
|
6
6
|
on:
|
|
7
7
|
push:
|
|
8
8
|
branches: ["main"]
|
|
9
|
-
pull_request:
|
|
10
|
-
branches: ["main"]
|
|
11
9
|
|
|
12
10
|
jobs:
|
|
13
|
-
|
|
11
|
+
checkout:
|
|
14
12
|
runs-on: ubuntu-latest
|
|
15
13
|
strategy:
|
|
16
14
|
fail-fast: false
|
|
@@ -40,10 +38,44 @@ jobs:
|
|
|
40
38
|
run: |
|
|
41
39
|
uv pip install -e ".[dev]"
|
|
42
40
|
|
|
41
|
+
publish:
|
|
42
|
+
needs: checkout
|
|
43
|
+
if: github.ref == 'refs/heads/main'
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@v4
|
|
47
|
+
with:
|
|
48
|
+
fetch-depth: 0
|
|
49
|
+
|
|
50
|
+
- name: Set up Python
|
|
51
|
+
uses: actions/setup-python@v5
|
|
52
|
+
with:
|
|
53
|
+
python-version: "3.11"
|
|
54
|
+
|
|
55
|
+
- name: Install uv
|
|
56
|
+
run: |
|
|
57
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
58
|
+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
59
|
+
|
|
60
|
+
- name: Create virtual environment
|
|
61
|
+
run: |
|
|
62
|
+
uv venv
|
|
63
|
+
|
|
64
|
+
- name: Install dependencies
|
|
65
|
+
run: |
|
|
66
|
+
uv pip install -e ".[dev]"
|
|
67
|
+
|
|
43
68
|
- name: Build and publish to PyPI
|
|
44
|
-
if: github.ref == 'refs/heads/main'
|
|
45
69
|
run: |
|
|
46
70
|
python -m pip install --upgrade pip
|
|
47
71
|
pip install build twine setuptools_scm
|
|
72
|
+
# Get the current version from pyproject.toml
|
|
73
|
+
CURRENT_VERSION=$(grep 'version = ' pyproject.toml | cut -d'"' -f2)
|
|
74
|
+
# Split version into major.minor.patch
|
|
75
|
+
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
|
|
76
|
+
# Increment minor version
|
|
77
|
+
NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
|
|
78
|
+
# Update version in pyproject.toml
|
|
79
|
+
sed -i "s/version = \".*\"/version = \"$NEW_VERSION\"/" pyproject.toml
|
|
48
80
|
python -m build
|
|
49
81
|
twine upload dist/* --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: blizzardapi2
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: A Python wrapper for Blizzard API
|
|
5
5
|
Author-email: lostcol0ny <c098os0k@4wrd.cc>
|
|
6
6
|
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
7
13
|
Requires-Python: >=3.11
|
|
8
14
|
Description-Content-Type: text/markdown
|
|
9
15
|
License-File: LICENSE
|
|
@@ -22,9 +28,14 @@ Requires-Dist: black<25.0.0,>=24.4.2; extra == "dev"
|
|
|
22
28
|
Requires-Dist: ruff<1.0.0,>=0.3.0; extra == "dev"
|
|
23
29
|
Dynamic: license-file
|
|
24
30
|
|
|
25
|
-
#
|
|
31
|
+
# Blizzard API 2
|
|
26
32
|
|
|
27
|
-
|
|
33
|
+
[](https://badge.fury.io/py/blizzardapi2)
|
|
34
|
+
[](https://pypi.org/project/blizzardapi2/)
|
|
35
|
+
[](https://pypi.org/project/blizzardapi2/)
|
|
36
|
+
[](https://github.com/lostcol0ny/python-blizzardapi2/actions/workflows/python-package.yml)
|
|
37
|
+
|
|
38
|
+
[](https://github.com/lostcol0ny/blizzardapi2/actions/workflows/dependabot/dependabot-updates)[](https://github.com/lostcol0ny/python-blizzardapi2/actions/workflows/github-code-scanning/codeql)[](https://github.com/psf/black)
|
|
28
39
|
|
|
29
40
|
blizzardapi2 is a client library for Blizzard's APIs. It's a fork of [the original library](https://github.com/trevorphillipscoding/python-blizzardapi/).
|
|
30
41
|
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Blizzard API 2
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://badge.fury.io/py/blizzardapi2)
|
|
4
|
+
[](https://pypi.org/project/blizzardapi2/)
|
|
5
|
+
[](https://pypi.org/project/blizzardapi2/)
|
|
6
|
+
[](https://github.com/lostcol0ny/python-blizzardapi2/actions/workflows/python-package.yml)
|
|
7
|
+
|
|
8
|
+
[](https://github.com/lostcol0ny/blizzardapi2/actions/workflows/dependabot/dependabot-updates)[](https://github.com/lostcol0ny/python-blizzardapi2/actions/workflows/github-code-scanning/codeql)[](https://github.com/psf/black)
|
|
4
9
|
|
|
5
10
|
blizzardapi2 is a client library for Blizzard's APIs. It's a fork of [the original library](https://github.com/trevorphillipscoding/python-blizzardapi/).
|
|
6
11
|
|
|
@@ -17,5 +17,5 @@ __version__: str
|
|
|
17
17
|
__version_tuple__: VERSION_TUPLE
|
|
18
18
|
version_tuple: VERSION_TUPLE
|
|
19
19
|
|
|
20
|
-
__version__ = version = '1.1.4b1.
|
|
21
|
-
__version_tuple__ = version_tuple = (1, 1, 4, 'b1', '
|
|
20
|
+
__version__ = version = '1.1.4b1.dev18+g1cd0183.d20250615020914'
|
|
21
|
+
__version_tuple__ = version_tuple = (1, 1, 4, 'b1', 'dev18', 'g1cd0183.d20250615020914')
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from enum import Enum
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Any, Dict, Literal, Optional, Protocol, TypedDict
|
|
6
6
|
|
|
7
7
|
import aiohttp
|
|
8
8
|
import requests
|
|
@@ -236,9 +236,9 @@ class BaseApi:
|
|
|
236
236
|
def __del__(self):
|
|
237
237
|
"""Clean up resources."""
|
|
238
238
|
try:
|
|
239
|
-
if hasattr(self,
|
|
239
|
+
if hasattr(self, "_session"):
|
|
240
240
|
self._session.close()
|
|
241
|
-
if hasattr(self,
|
|
241
|
+
if hasattr(self, "_async_session") and self._async_session is not None:
|
|
242
242
|
if not self._async_session.closed:
|
|
243
243
|
self._async_session.close()
|
|
244
244
|
except Exception:
|
|
@@ -5,7 +5,6 @@ a single client instance. Each game's API is accessible through its own
|
|
|
5
5
|
property on the main client.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
from .api import BaseApi
|
|
10
9
|
from .battlenet.battlenet_api import BattlenetApi
|
|
11
10
|
from .diablo3.diablo3_api import Diablo3Api
|
|
@@ -48,9 +47,9 @@ class BlizzardApi(BaseApi):
|
|
|
48
47
|
|
|
49
48
|
async def __aenter__(self) -> "BlizzardApi":
|
|
50
49
|
"""Async context manager entry.
|
|
51
|
-
|
|
50
|
+
|
|
52
51
|
Initializes async sessions for all game API clients.
|
|
53
|
-
|
|
52
|
+
|
|
54
53
|
Returns:
|
|
55
54
|
BlizzardApi: The initialized API client.
|
|
56
55
|
"""
|
|
@@ -61,12 +60,12 @@ class BlizzardApi(BaseApi):
|
|
|
61
60
|
await self.wow.__aenter__()
|
|
62
61
|
await self.starcraft2.__aenter__()
|
|
63
62
|
return self
|
|
64
|
-
|
|
63
|
+
|
|
65
64
|
async def __aexit__(self, exc_type, exc_val, exc_tb) -> None:
|
|
66
65
|
"""Async context manager exit.
|
|
67
|
-
|
|
66
|
+
|
|
68
67
|
Closes async sessions for all game API clients.
|
|
69
|
-
|
|
68
|
+
|
|
70
69
|
Args:
|
|
71
70
|
exc_type: The type of exception that was raised, if any.
|
|
72
71
|
exc_val: The exception instance that was raised, if any.
|
|
@@ -78,20 +77,20 @@ class BlizzardApi(BaseApi):
|
|
|
78
77
|
await self.hearthstone.__aexit__(exc_type, exc_val, exc_tb)
|
|
79
78
|
await self.wow.__aexit__(exc_type, exc_val, exc_tb)
|
|
80
79
|
await self.starcraft2.__aexit__(exc_type, exc_val, exc_tb)
|
|
81
|
-
|
|
80
|
+
|
|
82
81
|
@property
|
|
83
82
|
def client_id(self) -> str:
|
|
84
83
|
"""Get the client ID.
|
|
85
|
-
|
|
84
|
+
|
|
86
85
|
Returns:
|
|
87
86
|
str: The Blizzard API client ID.
|
|
88
87
|
"""
|
|
89
88
|
return self._client_id
|
|
90
|
-
|
|
89
|
+
|
|
91
90
|
@property
|
|
92
91
|
def client_secret(self) -> str:
|
|
93
92
|
"""Get the client secret.
|
|
94
|
-
|
|
93
|
+
|
|
95
94
|
Returns:
|
|
96
95
|
str: The Blizzard API client secret.
|
|
97
96
|
"""
|
|
@@ -51,7 +51,9 @@ class Diablo3CommunityApi(BaseApi):
|
|
|
51
51
|
query_params = {"locale": locale}
|
|
52
52
|
return self.get_resource(resource, region, query_params)
|
|
53
53
|
|
|
54
|
-
async def get_act_index_async(
|
|
54
|
+
async def get_act_index_async(
|
|
55
|
+
self, region: Region, locale: Locale
|
|
56
|
+
) -> Dict[str, Any]:
|
|
55
57
|
"""Get an index of acts asynchronously.
|
|
56
58
|
|
|
57
59
|
Args:
|
|
@@ -86,7 +88,9 @@ class Diablo3CommunityApi(BaseApi):
|
|
|
86
88
|
query_params = {"locale": locale}
|
|
87
89
|
return self.get_resource(resource, region, query_params)
|
|
88
90
|
|
|
89
|
-
async def get_act_async(
|
|
91
|
+
async def get_act_async(
|
|
92
|
+
self, region: Region, locale: Locale, act_id: int
|
|
93
|
+
) -> Dict[str, Any]:
|
|
90
94
|
"""Get a single act by ID asynchronously.
|
|
91
95
|
|
|
92
96
|
Args:
|
|
@@ -325,7 +329,9 @@ class Diablo3CommunityApi(BaseApi):
|
|
|
325
329
|
query_params = {"locale": locale}
|
|
326
330
|
return self.get_resource(resource, region, query_params)
|
|
327
331
|
|
|
328
|
-
async def get_item_type_index_async(
|
|
332
|
+
async def get_item_type_index_async(
|
|
333
|
+
self, region: Region, locale: Locale
|
|
334
|
+
) -> Dict[str, Any]:
|
|
329
335
|
"""Get an index of item types asynchronously.
|
|
330
336
|
|
|
331
337
|
Args:
|
|
@@ -679,7 +685,9 @@ class Diablo3CommunityApi(BaseApi):
|
|
|
679
685
|
query_params = {"locale": locale}
|
|
680
686
|
return self.get_resource(resource, region, query_params)
|
|
681
687
|
|
|
682
|
-
async def get_season_index_async(
|
|
688
|
+
async def get_season_index_async(
|
|
689
|
+
self, region: Region, locale: Locale
|
|
690
|
+
) -> Dict[str, Any]:
|
|
683
691
|
"""Get the current season index asynchronously.
|
|
684
692
|
|
|
685
693
|
Args:
|
|
@@ -102,7 +102,9 @@ class HearthstoneApi(BaseApi):
|
|
|
102
102
|
query_params = {"locale": locale}
|
|
103
103
|
return self.get_resource(resource, region, query_params)
|
|
104
104
|
|
|
105
|
-
async def get_card_backs_async(
|
|
105
|
+
async def get_card_backs_async(
|
|
106
|
+
self, region: Region, locale: Locale
|
|
107
|
+
) -> Dict[str, Any]:
|
|
106
108
|
"""Get all card backs asynchronously.
|
|
107
109
|
|
|
108
110
|
Args:
|
|
@@ -136,7 +138,9 @@ class HearthstoneApi(BaseApi):
|
|
|
136
138
|
query_params = {"locale": locale}
|
|
137
139
|
return self.get_resource(resource, region, query_params)
|
|
138
140
|
|
|
139
|
-
async def get_metadata_async(
|
|
141
|
+
async def get_metadata_async(
|
|
142
|
+
self, region: Region, locale: Locale
|
|
143
|
+
) -> Dict[str, Any]:
|
|
140
144
|
"""Get metadata asynchronously.
|
|
141
145
|
|
|
142
146
|
Args:
|
|
@@ -171,7 +175,9 @@ class HearthstoneApi(BaseApi):
|
|
|
171
175
|
query_params = {"locale": locale}
|
|
172
176
|
return self.get_resource(resource, region, query_params)
|
|
173
177
|
|
|
174
|
-
async def get_card_async(
|
|
178
|
+
async def get_card_async(
|
|
179
|
+
self, region: Region, locale: Locale, card_id: str
|
|
180
|
+
) -> Dict[str, Any]:
|
|
175
181
|
"""Get a single card asynchronously.
|
|
176
182
|
|
|
177
183
|
Args:
|
{blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/hearthstone/hearthstone_game_data_api.py
RENAMED
|
@@ -86,7 +86,9 @@ class HearthstoneGameDataApi(BaseApi):
|
|
|
86
86
|
query_params = {"locale": locale}
|
|
87
87
|
return self.get_resource(resource, region, query_params)
|
|
88
88
|
|
|
89
|
-
def get_card_search(
|
|
89
|
+
def get_card_search(
|
|
90
|
+
self, region: Region, locale: Locale, **kwargs
|
|
91
|
+
) -> Dict[str, Any]:
|
|
90
92
|
"""Search for cards with optional filters.
|
|
91
93
|
|
|
92
94
|
Args:
|
|
@@ -121,7 +123,9 @@ class HearthstoneGameDataApi(BaseApi):
|
|
|
121
123
|
query_params = {"locale": locale}
|
|
122
124
|
return self.get_resource(resource, region, query_params)
|
|
123
125
|
|
|
124
|
-
def get_card_back(
|
|
126
|
+
def get_card_back(
|
|
127
|
+
self, region: Region, locale: Locale, card_back_id: str
|
|
128
|
+
) -> Dict[str, Any]:
|
|
125
129
|
"""Get a single card back by ID.
|
|
126
130
|
|
|
127
131
|
Args:
|
|
@@ -139,7 +143,9 @@ class HearthstoneGameDataApi(BaseApi):
|
|
|
139
143
|
query_params = {"locale": locale}
|
|
140
144
|
return self.get_resource(resource, region, query_params)
|
|
141
145
|
|
|
142
|
-
def get_deck(
|
|
146
|
+
def get_deck(
|
|
147
|
+
self, region: Region, locale: Locale, deck_code: str
|
|
148
|
+
) -> Dict[str, Any]:
|
|
143
149
|
"""Get a deck by deck code.
|
|
144
150
|
|
|
145
151
|
Args:
|
|
@@ -157,7 +163,9 @@ class HearthstoneGameDataApi(BaseApi):
|
|
|
157
163
|
query_params = {"locale": locale}
|
|
158
164
|
return self.get_resource(resource, region, query_params)
|
|
159
165
|
|
|
160
|
-
def get_metadata_search(
|
|
166
|
+
def get_metadata_search(
|
|
167
|
+
self, region: Region, locale: Locale, **kwargs
|
|
168
|
+
) -> Dict[str, Any]:
|
|
161
169
|
"""Search for metadata with optional filters.
|
|
162
170
|
|
|
163
171
|
Args:
|
|
@@ -31,7 +31,12 @@ class Starcraft2Api(BaseApi):
|
|
|
31
31
|
self.game_data = Starcraft2GameDataApi(client_id, client_secret)
|
|
32
32
|
|
|
33
33
|
def get_league_data(
|
|
34
|
-
self,
|
|
34
|
+
self,
|
|
35
|
+
region: Region,
|
|
36
|
+
locale: Locale,
|
|
37
|
+
season_id: int,
|
|
38
|
+
queue_id: int,
|
|
39
|
+
team_type: int,
|
|
35
40
|
) -> Dict[str, Any]:
|
|
36
41
|
"""Get league data for a specific season, queue, and team type.
|
|
37
42
|
|
|
@@ -91,7 +96,12 @@ class Starcraft2Api(BaseApi):
|
|
|
91
96
|
return self.get_resource(resource, region, query_params)
|
|
92
97
|
|
|
93
98
|
def get_player_ladder(
|
|
94
|
-
self,
|
|
99
|
+
self,
|
|
100
|
+
region: Region,
|
|
101
|
+
locale: Locale,
|
|
102
|
+
profile_id: int,
|
|
103
|
+
realm_id: int,
|
|
104
|
+
ladder_id: int,
|
|
95
105
|
) -> Dict[str, Any]:
|
|
96
106
|
"""Get a player's ladder information.
|
|
97
107
|
|
{blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/starcraft2/starcraft2_community_api.py
RENAMED
|
@@ -51,7 +51,9 @@ class Starcraft2CommunityApi(BaseApi):
|
|
|
51
51
|
"""
|
|
52
52
|
super().__init__(client_id, client_secret)
|
|
53
53
|
|
|
54
|
-
def get_static(
|
|
54
|
+
def get_static(
|
|
55
|
+
self, region: Region, locale: Locale, region_id: int
|
|
56
|
+
) -> dict[str, Any]:
|
|
55
57
|
"""Get all static SC2 profile data.
|
|
56
58
|
|
|
57
59
|
This includes achievements, categories, criteria, and rewards.
|
|
@@ -72,7 +74,12 @@ class Starcraft2CommunityApi(BaseApi):
|
|
|
72
74
|
return self.get_resource(resource, region, query_params)
|
|
73
75
|
|
|
74
76
|
def get_metadata(
|
|
75
|
-
self,
|
|
77
|
+
self,
|
|
78
|
+
region: Region,
|
|
79
|
+
locale: Locale,
|
|
80
|
+
region_id: int,
|
|
81
|
+
realm_id: int,
|
|
82
|
+
profile_id: int,
|
|
76
83
|
) -> dict[str, Any]:
|
|
77
84
|
"""Get metadata for an individual's profile.
|
|
78
85
|
|
|
@@ -152,7 +159,12 @@ class Starcraft2CommunityApi(BaseApi):
|
|
|
152
159
|
return await self.get_resource_async(resource, region, query_params)
|
|
153
160
|
|
|
154
161
|
def get_ladder_summary(
|
|
155
|
-
self,
|
|
162
|
+
self,
|
|
163
|
+
region: Region,
|
|
164
|
+
locale: Locale,
|
|
165
|
+
region_id: int,
|
|
166
|
+
realm_id: int,
|
|
167
|
+
profile_id: int,
|
|
156
168
|
) -> dict[str, Any]:
|
|
157
169
|
"""Get a ladder summary for an individual SC2 profile.
|
|
158
170
|
|
|
@@ -174,7 +186,12 @@ class Starcraft2CommunityApi(BaseApi):
|
|
|
174
186
|
return self.get_resource(resource, region, query_params)
|
|
175
187
|
|
|
176
188
|
async def get_ladder_summary_async(
|
|
177
|
-
self,
|
|
189
|
+
self,
|
|
190
|
+
region: Region,
|
|
191
|
+
locale: Locale,
|
|
192
|
+
region_id: int,
|
|
193
|
+
realm_id: int,
|
|
194
|
+
profile_id: int,
|
|
178
195
|
) -> dict[str, Any]:
|
|
179
196
|
"""Get a ladder summary for an individual SC2 profile asynchronously.
|
|
180
197
|
|
|
@@ -222,7 +239,9 @@ class Starcraft2CommunityApi(BaseApi):
|
|
|
222
239
|
Raises:
|
|
223
240
|
ApiError: If the API request fails.
|
|
224
241
|
"""
|
|
225
|
-
resource =
|
|
242
|
+
resource = (
|
|
243
|
+
f"/sc2/profile/{region_id}/{realm_id}/{profile_id}/ladder/{ladder_id}"
|
|
244
|
+
)
|
|
226
245
|
query_params["locale"] = locale
|
|
227
246
|
return self.get_resource(resource, region, query_params)
|
|
228
247
|
|
|
@@ -253,7 +272,9 @@ class Starcraft2CommunityApi(BaseApi):
|
|
|
253
272
|
Raises:
|
|
254
273
|
ApiError: If the API request fails.
|
|
255
274
|
"""
|
|
256
|
-
resource =
|
|
275
|
+
resource = (
|
|
276
|
+
f"/sc2/profile/{region_id}/{realm_id}/{profile_id}/ladder/{ladder_id}"
|
|
277
|
+
)
|
|
257
278
|
query_params["locale"] = locale
|
|
258
279
|
return await self.get_resource_async(resource, region, query_params)
|
|
259
280
|
|
|
@@ -297,7 +318,9 @@ class Starcraft2CommunityApi(BaseApi):
|
|
|
297
318
|
query_params = {"locale": locale}
|
|
298
319
|
return await self.get_resource_async(resource, region, query_params)
|
|
299
320
|
|
|
300
|
-
def get_season(
|
|
321
|
+
def get_season(
|
|
322
|
+
self, region: Region, locale: Locale, region_id: int
|
|
323
|
+
) -> dict[str, Any]:
|
|
301
324
|
"""Get data about the current season.
|
|
302
325
|
|
|
303
326
|
Args:
|
|
@@ -315,7 +338,9 @@ class Starcraft2CommunityApi(BaseApi):
|
|
|
315
338
|
query_params = {"locale": locale}
|
|
316
339
|
return self.get_resource(resource, region, query_params)
|
|
317
340
|
|
|
318
|
-
async def get_season_async(
|
|
341
|
+
async def get_season_async(
|
|
342
|
+
self, region: Region, locale: Locale, region_id: int
|
|
343
|
+
) -> dict[str, Any]:
|
|
319
344
|
"""Get data about the current season asynchronously.
|
|
320
345
|
|
|
321
346
|
Args:
|
|
@@ -334,7 +359,12 @@ class Starcraft2CommunityApi(BaseApi):
|
|
|
334
359
|
return await self.get_resource_async(resource, region, query_params)
|
|
335
360
|
|
|
336
361
|
def get_league_data(
|
|
337
|
-
self,
|
|
362
|
+
self,
|
|
363
|
+
region: Region,
|
|
364
|
+
locale: Locale,
|
|
365
|
+
season_id: int,
|
|
366
|
+
queue_id: int,
|
|
367
|
+
team_type: int,
|
|
338
368
|
) -> dict[str, Any]:
|
|
339
369
|
"""Get league data for a specific season, queue, and team type.
|
|
340
370
|
|
|
@@ -356,7 +386,12 @@ class Starcraft2CommunityApi(BaseApi):
|
|
|
356
386
|
return self.get_resource(resource, region, query_params)
|
|
357
387
|
|
|
358
388
|
async def get_league_data_async(
|
|
359
|
-
self,
|
|
389
|
+
self,
|
|
390
|
+
region: Region,
|
|
391
|
+
locale: Locale,
|
|
392
|
+
season_id: int,
|
|
393
|
+
queue_id: int,
|
|
394
|
+
team_type: int,
|
|
360
395
|
) -> dict[str, Any]:
|
|
361
396
|
"""Get league data for a specific season, queue, and team type asynchronously.
|
|
362
397
|
|
|
@@ -378,7 +413,12 @@ class Starcraft2CommunityApi(BaseApi):
|
|
|
378
413
|
return await self.get_resource_async(resource, region, query_params)
|
|
379
414
|
|
|
380
415
|
def get_player_ladder_summary(
|
|
381
|
-
self,
|
|
416
|
+
self,
|
|
417
|
+
region: Region,
|
|
418
|
+
locale: Locale,
|
|
419
|
+
region_id: int,
|
|
420
|
+
realm_id: int,
|
|
421
|
+
profile_id: int,
|
|
382
422
|
) -> dict[str, Any]:
|
|
383
423
|
"""Get a player's ladder summary.
|
|
384
424
|
|
|
@@ -400,7 +440,12 @@ class Starcraft2CommunityApi(BaseApi):
|
|
|
400
440
|
return self.get_resource(resource, region, query_params)
|
|
401
441
|
|
|
402
442
|
async def get_player_ladder_summary_async(
|
|
403
|
-
self,
|
|
443
|
+
self,
|
|
444
|
+
region: Region,
|
|
445
|
+
locale: Locale,
|
|
446
|
+
region_id: int,
|
|
447
|
+
realm_id: int,
|
|
448
|
+
profile_id: int,
|
|
404
449
|
) -> dict[str, Any]:
|
|
405
450
|
"""Get a player's ladder summary asynchronously.
|
|
406
451
|
|
|
@@ -421,7 +466,9 @@ class Starcraft2CommunityApi(BaseApi):
|
|
|
421
466
|
query_params = {"locale": locale}
|
|
422
467
|
return await self.get_resource_async(resource, region, query_params)
|
|
423
468
|
|
|
424
|
-
def get_player(
|
|
469
|
+
def get_player(
|
|
470
|
+
self, region: Region, locale: Locale, account_id: int
|
|
471
|
+
) -> dict[str, Any]:
|
|
425
472
|
"""Get metadata for an individual's account.
|
|
426
473
|
|
|
427
474
|
Args:
|
{blizzardapi2-2.0.0 → blizzardapi2-2.0.2}/blizzardapi2/starcraft2/starcraft2_game_data_api.py
RENAMED
|
@@ -50,7 +50,12 @@ class Starcraft2GameDataApi(BaseApi):
|
|
|
50
50
|
super().__init__(client_id, client_secret)
|
|
51
51
|
|
|
52
52
|
def get_league_data(
|
|
53
|
-
self,
|
|
53
|
+
self,
|
|
54
|
+
region: Region,
|
|
55
|
+
season_id: int,
|
|
56
|
+
queue_id: int,
|
|
57
|
+
team_type: int,
|
|
58
|
+
league_id: int,
|
|
54
59
|
) -> dict[str, Any]:
|
|
55
60
|
"""Get data for the specified season, queue, team, and league.
|
|
56
61
|
|
|
@@ -3,14 +3,17 @@ from enum import Enum
|
|
|
3
3
|
|
|
4
4
|
class Region(str, Enum):
|
|
5
5
|
"""Region enum for Blizzard API endpoints."""
|
|
6
|
+
|
|
6
7
|
US = "us"
|
|
7
8
|
EU = "eu"
|
|
8
9
|
KR = "kr"
|
|
9
10
|
TW = "tw"
|
|
10
11
|
CN = "cn"
|
|
11
12
|
|
|
13
|
+
|
|
12
14
|
class Locale(str, Enum):
|
|
13
15
|
"""Locale enum for Blizzard API responses."""
|
|
16
|
+
|
|
14
17
|
EN_US = "en_US"
|
|
15
18
|
EN_GB = "en_GB"
|
|
16
19
|
ES_ES = "es_ES"
|
|
@@ -23,4 +26,4 @@ class Locale(str, Enum):
|
|
|
23
26
|
RU_RU = "ru_RU"
|
|
24
27
|
KO_KR = "ko_KR"
|
|
25
28
|
ZH_TW = "zh_TW"
|
|
26
|
-
ZH_CN = "zh_CN"
|
|
29
|
+
ZH_CN = "zh_CN"
|
|
@@ -875,25 +875,33 @@ class WowProfileApi(BaseApi):
|
|
|
875
875
|
query_params = {"namespace": f"profile-{region}", "locale": locale}
|
|
876
876
|
return self.get_resource(resource, region, query_params)
|
|
877
877
|
|
|
878
|
-
def get_character_profile(
|
|
878
|
+
def get_character_profile(
|
|
879
|
+
self, region: Region, locale: Locale, realm: str, character: str
|
|
880
|
+
) -> Dict[str, Any]:
|
|
879
881
|
"""Get a character profile."""
|
|
880
882
|
resource = f"/profile/wow/character/{realm}/{character}"
|
|
881
883
|
query_params = {"locale": locale}
|
|
882
884
|
return self.get_resource(resource, region, query_params)
|
|
883
885
|
|
|
884
|
-
async def get_character_profile_async(
|
|
886
|
+
async def get_character_profile_async(
|
|
887
|
+
self, region: Region, locale: Locale, realm: str, character: str
|
|
888
|
+
) -> Dict[str, Any]:
|
|
885
889
|
"""Get a character profile asynchronously."""
|
|
886
890
|
resource = f"/profile/wow/character/{realm}/{character}"
|
|
887
891
|
query_params = {"locale": locale}
|
|
888
892
|
return await self.get_resource_async(resource, region, query_params)
|
|
889
893
|
|
|
890
|
-
def get_character_achievements(
|
|
894
|
+
def get_character_achievements(
|
|
895
|
+
self, region: Region, locale: Locale, realm: str, character: str
|
|
896
|
+
) -> Dict[str, Any]:
|
|
891
897
|
"""Get a character's achievements."""
|
|
892
898
|
resource = f"/profile/wow/character/{realm}/{character}/achievements"
|
|
893
899
|
query_params = {"locale": locale}
|
|
894
900
|
return self.get_resource(resource, region, query_params)
|
|
895
901
|
|
|
896
|
-
async def get_character_achievements_async(
|
|
902
|
+
async def get_character_achievements_async(
|
|
903
|
+
self, region: Region, locale: Locale, realm: str, character: str
|
|
904
|
+
) -> Dict[str, Any]:
|
|
897
905
|
"""Get a character's achievements asynchronously."""
|
|
898
906
|
resource = f"/profile/wow/character/{realm}/{character}/achievements"
|
|
899
907
|
query_params = {"locale": locale}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: blizzardapi2
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: A Python wrapper for Blizzard API
|
|
5
5
|
Author-email: lostcol0ny <c098os0k@4wrd.cc>
|
|
6
6
|
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
7
13
|
Requires-Python: >=3.11
|
|
8
14
|
Description-Content-Type: text/markdown
|
|
9
15
|
License-File: LICENSE
|
|
@@ -22,9 +28,14 @@ Requires-Dist: black<25.0.0,>=24.4.2; extra == "dev"
|
|
|
22
28
|
Requires-Dist: ruff<1.0.0,>=0.3.0; extra == "dev"
|
|
23
29
|
Dynamic: license-file
|
|
24
30
|
|
|
25
|
-
#
|
|
31
|
+
# Blizzard API 2
|
|
26
32
|
|
|
27
|
-
|
|
33
|
+
[](https://badge.fury.io/py/blizzardapi2)
|
|
34
|
+
[](https://pypi.org/project/blizzardapi2/)
|
|
35
|
+
[](https://pypi.org/project/blizzardapi2/)
|
|
36
|
+
[](https://github.com/lostcol0ny/python-blizzardapi2/actions/workflows/python-package.yml)
|
|
37
|
+
|
|
38
|
+
[](https://github.com/lostcol0ny/blizzardapi2/actions/workflows/dependabot/dependabot-updates)[](https://github.com/lostcol0ny/python-blizzardapi2/actions/workflows/github-code-scanning/codeql)[](https://github.com/psf/black)
|
|
28
39
|
|
|
29
40
|
blizzardapi2 is a client library for Blizzard's APIs. It's a fork of [the original library](https://github.com/trevorphillipscoding/python-blizzardapi/).
|
|
30
41
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "blizzardapi2"
|
|
3
|
-
version = "2.0.
|
|
3
|
+
version = "2.0.2"
|
|
4
4
|
description = "A Python wrapper for Blizzard API"
|
|
5
5
|
authors = [{ name = "lostcol0ny", email = "c098os0k@4wrd.cc" }]
|
|
6
6
|
license = { text = "MIT" }
|
|
@@ -15,6 +15,14 @@ dependencies = [
|
|
|
15
15
|
"aiohttp>=3.12.12",
|
|
16
16
|
]
|
|
17
17
|
requires-python = ">=3.11"
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"License :: OSI Approved :: MIT License",
|
|
24
|
+
"Operating System :: OS Independent",
|
|
25
|
+
]
|
|
18
26
|
|
|
19
27
|
[build-system]
|
|
20
28
|
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=6.2"]
|
|
@@ -68,7 +76,7 @@ exclude = [
|
|
|
68
76
|
line-length = 120
|
|
69
77
|
|
|
70
78
|
# Assume Python 3.1
|
|
71
|
-
target-version = "
|
|
79
|
+
target-version = "2.0.2"
|
|
72
80
|
|
|
73
81
|
[tool.ruff.lint]
|
|
74
82
|
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|