blizzardapi2 3.0.0__tar.gz → 3.0.3__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.
Files changed (63) hide show
  1. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/.github/workflows/python-package.yml +28 -49
  2. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/.release-it.json +1 -1
  3. {blizzardapi2-3.0.0/blizzardapi2.egg-info → blizzardapi2-3.0.3}/PKG-INFO +3 -1
  4. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/types.py +3 -3
  5. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3/blizzardapi2.egg-info}/PKG-INFO +3 -1
  6. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2.egg-info/SOURCES.txt +1 -0
  7. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2.egg-info/requires.txt +2 -0
  8. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/package.json +1 -1
  9. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/pyproject.toml +3 -1
  10. blizzardapi2-3.0.3/tests/test_types.py +52 -0
  11. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  12. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  13. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/.github/dependabot.yml +0 -0
  14. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/.github/workflows/README.md +0 -0
  15. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/.github/workflows/black-check.yml +0 -0
  16. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/.gitignore +0 -0
  17. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/.pre-commit-config.yaml +0 -0
  18. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/CLAUDE.md +0 -0
  19. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/CODE_OF_CONDUCT.md +0 -0
  20. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/CONTRIBUTING.md +0 -0
  21. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/LICENSE +0 -0
  22. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/README.md +0 -0
  23. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/SECURITY.md +0 -0
  24. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/__init__.py +0 -0
  25. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/api.py +0 -0
  26. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/battlenet/__init__.py +0 -0
  27. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/battlenet/battlenet_api.py +0 -0
  28. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/battlenet/battlenet_oauth_api.py +0 -0
  29. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/blizzard_api.py +0 -0
  30. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/diablo3/__init__.py +0 -0
  31. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/diablo3/diablo3_api.py +0 -0
  32. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/diablo3/diablo3_community_api.py +0 -0
  33. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/diablo3/diablo3_game_data_api.py +0 -0
  34. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/hearthstone/__init__.py +0 -0
  35. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/hearthstone/hearthstone_api.py +0 -0
  36. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/hearthstone/hearthstone_game_data_api.py +0 -0
  37. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/starcraft2/__init__.py +0 -0
  38. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/starcraft2/starcraft2_api.py +0 -0
  39. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/starcraft2/starcraft2_community_api.py +0 -0
  40. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/starcraft2/starcraft2_game_data_api.py +0 -0
  41. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/wow/__init__.py +0 -0
  42. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/wow/wow_api.py +0 -0
  43. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/wow/wow_game_data_api.py +0 -0
  44. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2/wow/wow_profile_api.py +0 -0
  45. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2.egg-info/dependency_links.txt +0 -0
  46. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/blizzardapi2.egg-info/top_level.txt +0 -0
  47. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/docs/battlenet/README.md +0 -0
  48. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/docs/diablo3/README.md +0 -0
  49. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/docs/hearthstone/README.md +0 -0
  50. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/docs/pull_request_template.md +0 -0
  51. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/docs/starcraft2/README.md +0 -0
  52. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/docs/wow/README.md +0 -0
  53. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/poetry.lock +0 -0
  54. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/setup.cfg +0 -0
  55. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/tests/__init__.py +0 -0
  56. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/tests/conftest.py +0 -0
  57. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/tests/test_base_api.py +0 -0
  58. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/tests/test_battlenet.py +0 -0
  59. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/tests/test_diablo3.py +0 -0
  60. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/tests/test_hearthstone.py +0 -0
  61. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/tests/test_starcraft2.py +0 -0
  62. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/tests/test_wow.py +0 -0
  63. {blizzardapi2-3.0.0 → blizzardapi2-3.0.3}/uv.lock +0 -0
@@ -43,56 +43,15 @@ jobs:
43
43
  - name: Run tests
44
44
  run: uv run pytest tests/ -v
45
45
 
46
- publish:
46
+ release:
47
47
  needs: test
48
48
  if: github.ref == 'refs/heads/main'
49
49
  runs-on: ubuntu-latest
50
- steps:
51
- - uses: actions/checkout@v4
52
- with:
53
- fetch-depth: 0
54
-
55
- - name: Set up Python
56
- uses: actions/setup-python@v5
57
- with:
58
- python-version: "3.11"
59
-
60
- - name: Install uv
61
- run: |
62
- curl -LsSf https://astral.sh/uv/install.sh | sh
63
- echo "$HOME/.cargo/bin" >> $GITHUB_PATH
64
-
65
- - name: Create virtual environment
66
- run: |
67
- uv venv
68
-
69
- - name: Install dependencies
70
- run: |
71
- uv pip install -e ".[dev]"
72
- - name: Configure Git
73
- run: |
74
- git config --global user.name "lostcol0ny"
75
- git config --global user.email "c098os0k@4wrd.cc"
76
-
77
- - name: Build and publish to PyPI
78
- run: |
79
- python -m pip install --upgrade pip
80
- pip install build twine setuptools_scm
81
- python -m build
82
- twine upload dist/* --skip-existing --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} || {
83
- echo "Upload failed - version may already exist or filename was previously used"
84
- echo "This is expected behavior and won't block the release"
85
- exit 0
86
- }
87
- env:
88
- PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
89
-
90
- release:
91
- needs: publish
92
- runs-on: ubuntu-latest
93
50
  permissions:
94
51
  contents: write
95
52
  id-token: write
53
+ outputs:
54
+ tag: ${{ steps.bump.outputs.tag }}
96
55
  steps:
97
56
  - name: Checkout repository
98
57
  uses: actions/checkout@v4
@@ -122,16 +81,36 @@ jobs:
122
81
  && sudo apt install gh -y
123
82
 
124
83
  - name: Run release script
84
+ id: bump
125
85
  env:
126
86
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127
87
  run: |
128
- # Debug: Check current version
129
- echo "Current package.json version: $(node -p "require('./package.json').version")"
130
- echo "Current pyproject.toml version: $(grep 'version = ' pyproject.toml | head -n 1 | cut -d'"' -f2)"
131
-
132
- # Run release-it with CI mode
133
88
  npx release-it --ci || {
134
89
  echo "release-it failed, creating GitHub release manually..."
135
90
  VERSION=$(node -p "require('./package.json').version")
136
91
  gh release create "v$VERSION" --title "Release v$VERSION" --notes "Release v$VERSION"
137
92
  }
93
+ tag=$(git describe --tags --abbrev=0)
94
+ echo "tag=$tag" >> "$GITHUB_OUTPUT"
95
+
96
+ publish:
97
+ needs: release
98
+ runs-on: ubuntu-latest
99
+ steps:
100
+ - uses: actions/checkout@v4
101
+ with:
102
+ ref: ${{ needs.release.outputs.tag }}
103
+ fetch-depth: 0
104
+
105
+ - name: Set up Python
106
+ uses: actions/setup-python@v5
107
+ with:
108
+ python-version: "3.11"
109
+
110
+ - name: Build and publish to PyPI
111
+ env:
112
+ PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
113
+ run: |
114
+ python -m pip install --upgrade pip build twine
115
+ python -m build
116
+ twine upload dist/* --skip-existing --username __token__ --password "$PYPI_API_TOKEN"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "git": {
3
- "commitMessage": "chore: release v${version}",
3
+ "commitMessage": "chore: release v${version} [skip ci]",
4
4
  "tagName": "v${version}"
5
5
  },
6
6
  "github": {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: blizzardapi2
3
- Version: 3.0.0
3
+ Version: 3.0.3
4
4
  Summary: A Python wrapper for Blizzard API
5
5
  Author-email: lostcol0ny <c098os0k@4wrd.cc>
6
6
  License-Expression: MIT
@@ -19,6 +19,8 @@ Requires-Dist: pytest-mock<4.0.0,>=3.14.0; extra == "dev"
19
19
  Requires-Dist: pytest-asyncio<2.0.0,>=0.23.5; extra == "dev"
20
20
  Requires-Dist: black<27.0.0,>=26.3.1; extra == "dev"
21
21
  Requires-Dist: ruff<1.0.0,>=0.3.0; extra == "dev"
22
+ Requires-Dist: build<2.0.0,>=1.2.0; extra == "dev"
23
+ Requires-Dist: twine<7.0.0,>=5.0.0; extra == "dev"
22
24
  Dynamic: license-file
23
25
 
24
26
  # Blizzard API 2
@@ -1,7 +1,7 @@
1
- from enum import Enum
1
+ from enum import StrEnum
2
2
 
3
3
 
4
- class Region(str, Enum):
4
+ class Region(StrEnum):
5
5
  """Region enum for Blizzard API endpoints."""
6
6
 
7
7
  US = "us"
@@ -11,7 +11,7 @@ class Region(str, Enum):
11
11
  CN = "cn"
12
12
 
13
13
 
14
- class Locale(str, Enum):
14
+ class Locale(StrEnum):
15
15
  """Locale enum for Blizzard API responses."""
16
16
 
17
17
  EN_US = "en_US"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: blizzardapi2
3
- Version: 3.0.0
3
+ Version: 3.0.3
4
4
  Summary: A Python wrapper for Blizzard API
5
5
  Author-email: lostcol0ny <c098os0k@4wrd.cc>
6
6
  License-Expression: MIT
@@ -19,6 +19,8 @@ Requires-Dist: pytest-mock<4.0.0,>=3.14.0; extra == "dev"
19
19
  Requires-Dist: pytest-asyncio<2.0.0,>=0.23.5; extra == "dev"
20
20
  Requires-Dist: black<27.0.0,>=26.3.1; extra == "dev"
21
21
  Requires-Dist: ruff<1.0.0,>=0.3.0; extra == "dev"
22
+ Requires-Dist: build<2.0.0,>=1.2.0; extra == "dev"
23
+ Requires-Dist: twine<7.0.0,>=5.0.0; extra == "dev"
22
24
  Dynamic: license-file
23
25
 
24
26
  # Blizzard API 2
@@ -57,4 +57,5 @@ tests/test_battlenet.py
57
57
  tests/test_diablo3.py
58
58
  tests/test_hearthstone.py
59
59
  tests/test_starcraft2.py
60
+ tests/test_types.py
60
61
  tests/test_wow.py
@@ -6,3 +6,5 @@ pytest-mock<4.0.0,>=3.14.0
6
6
  pytest-asyncio<2.0.0,>=0.23.5
7
7
  black<27.0.0,>=26.3.1
8
8
  ruff<1.0.0,>=0.3.0
9
+ build<2.0.0,>=1.2.0
10
+ twine<7.0.0,>=5.0.0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blizzardapi2",
3
- "version": "3.0.0",
3
+ "version": "3.0.3",
4
4
  "scripts": {
5
5
  "release": "release-it"
6
6
  },
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "blizzardapi2"
3
- version = "3.0.0"
3
+ version = "3.0.3"
4
4
  description = "A Python wrapper for Blizzard API"
5
5
  authors = [{ name = "lostcol0ny", email = "c098os0k@4wrd.cc" }]
6
6
  license = "MIT"
@@ -40,6 +40,8 @@ dev = [
40
40
  "pytest-asyncio>=0.23.5,<2.0.0",
41
41
  "black>=26.3.1,<27.0.0",
42
42
  "ruff>=0.3.0,<1.0.0",
43
+ "build>=1.2.0,<2.0.0",
44
+ "twine>=5.0.0,<7.0.0",
43
45
  ]
44
46
 
45
47
  [tool.ruff]
@@ -0,0 +1,52 @@
1
+ """Regression tests for `Region` and `Locale` string formatting.
2
+
3
+ Python 3.11 changed how `(str, Enum)` subclasses render in f-strings and
4
+ `str.format()` — `f"{Region.US}"` produces `"Region.US"` instead of `"us"`.
5
+ That broke every endpoint method that interpolates these enums into URLs
6
+ or query parameters. Inheriting from `enum.StrEnum` (3.11+) restores the
7
+ expected value-formatting behavior. These tests pin that contract so the
8
+ regression cannot recur silently.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ from blizzardapi2.api import BaseApi
14
+ from blizzardapi2.types import Locale, Region
15
+ from tests.conftest import CLIENT_ID, CLIENT_SECRET
16
+
17
+
18
+ def test_region_fstring_yields_value() -> None:
19
+ """`f"{Region.US}"` must produce the string value, not the member name."""
20
+ assert f"{Region.US}" == "us"
21
+
22
+
23
+ def test_locale_fstring_yields_value() -> None:
24
+ """`f"{Locale.EN_US}"` must produce the string value, not the member name."""
25
+ assert f"{Locale.EN_US}" == "en_US"
26
+
27
+
28
+ def test_region_str_yields_value() -> None:
29
+ """`str(Region.EU)` must produce the value — `requests` relies on this when
30
+ the enum is passed directly into URL params."""
31
+ assert str(Region.EU) == "eu"
32
+
33
+
34
+ def test_namespace_interpolation_yields_value() -> None:
35
+ """The `static-{region}` pattern used across game-data endpoints must
36
+ render the region value, not the member repr."""
37
+ assert f"static-{Region.US}" == "static-us"
38
+
39
+
40
+ def test_build_api_url_accepts_region_enum() -> None:
41
+ """`BaseApi._build_api_url` must produce a clean host when handed a
42
+ `Region` enum — this is the exact path that broke in issue #50."""
43
+ api = BaseApi(CLIENT_ID, CLIENT_SECRET)
44
+ url = api._build_api_url("/data/wow/achievement-category/index", Region.US)
45
+ assert url == "https://us.api.blizzard.com/data/wow/achievement-category/index"
46
+
47
+
48
+ def test_build_api_url_cn_region_enum_routes_to_gateway() -> None:
49
+ """`Region.CN` must take the China gateway branch in `_build_api_url`."""
50
+ api = BaseApi(CLIENT_ID, CLIENT_SECRET)
51
+ url = api._build_api_url("/data/wow/realm/index", Region.CN)
52
+ assert url == "https://gateway.battlenet.com.cn/data/wow/realm/index"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes