Blizzard API 2
blizzardapi2 is a client library for Blizzard's APIs. It's a fork of the original library.
Current supported features include:
- Battle.net User
- WoW Profile
- WoW Game Data
- WoW Classic Game Data
- Diablo 3 Community
- Diablo 3 Game Data
- Hearthstone Game Data
- Starcraft 2 Community
- Starcraft 2 Game Data
Modern features:
- Full type hints support
- Automatic token management with intelligent refresh
- Enum-based region and locale validation
- Clean, maintainable codebase
- Comprehensive error handling
To gain access to Blizzard's API please register here to obtain a client id and client secret.
For more information on Blizzard's API visit:
Official Documentation
Official API Forum
Requirements
Python (3.11+)
Installing
pip install blizzardapi2
Examples
Basic Usage
from blizzardapi2 import BlizzardApi, Region, Locale
api_client = BlizzardApi("client_id", "client_secret")
# Public API endpoint (uses automatic client credentials token)
categories_index = api_client.wow.game_data.get_achievement_categories_index(
region=Region.US,
locale=Locale.EN_US,
)
# Protected API endpoint (requires user OAuth token)
summary = api_client.wow.profile.get_account_profile_summary(
"user_access_token", # OAuth token from authorization code flow
region=Region.US,
locale=Locale.EN_US,
)
# WoW Classic endpoint
connected_realms_index = api_client.wow.game_data.get_connected_realms_index(
region=Region.US,
locale=Locale.EN_US,
is_classic=True,
)
Token Management
The library automatically manages client credentials tokens for public endpoints:
from blizzardapi2 import BlizzardApi, Region, Locale
api_client = BlizzardApi("client_id", "client_secret")
# First call: library automatically fetches and caches a client credentials token
realms = api_client.wow.game_data.get_realms_index(
region=Region.US,
locale=Locale.EN_US,
)
# Subsequent calls: library reuses the cached token
achievements = api_client.wow.game_data.get_achievements_index(
region=Region.US,
locale=Locale.EN_US,
)
# When token expires: library automatically refreshes it
# You don't need to manage tokens manually!
Access token vs Client ID/Client Secret
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.
Important: The library handles all tokens securely by passing them in Authorization headers, never in URLs. When you provide a user OAuth token to methods like get_account_profile_summary(), the library automatically:
- Extracts the token from parameters
- Sends it via
Authorization: Bearer <token>header - Keeps tokens out of URL query strings
Here is the list of endpoints, and related API methods, that require an OAuth authorization code token:
| Resource path | API call |
|---|---|
| /userinfo | .battlenet.oauth.get_user_info(access_token) |
| /profile/user/wow | .wow.profile.get_account_profile_summary(access_token) |
| /profile/user/wow/protected-character/{realm-id}-{character-id} | .wow.profile.get_protected_character_profile_summary(access_token, realm_id, character_id) |
| /profile/user/wow/collections | .wow.profile.get_account_collections_index(access_token) |
| /profile/user/wow/collections/heirlooms | .wow.profile.get_account_heirlooms_collection_summary(access_token) |
| /profile/user/wow/collections/mounts | .wow.profile.get_account_mounts_collection_summary(access_token) |
| /profile/user/wow/collections/pets | .wow.profile.get_account_pets_collection_summary(access_token) |
| /profile/user/wow/collections/toys | .wow.profile.get_account_toys_collection_summary(access_token) |
| /profile/user/wow/collections/transmogs | .wow.profile.get_account_transmog_collection_summary(access_token) |
Note: For these protected endpoints, you must implement the OAuth authorization code flow in your application to obtain a user access token. The library does not handle the OAuth flow itself - it only accepts and uses the token you provide.
Documentation
For detailed documentation on each game's API, see the following README files:
Metadata
Release files for blizzardapi2 5.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| blizzardapi2-5.0.0.tar.gz | 108.6 kB | Without provenance | Details for blizzardapi2-5.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| blizzardapi2-5.0.0-py3-none-any.whl | Python 3 | none | any | Details for blizzardapi2-5.0.0-py3-none-any.whl |
Total release size: 138.8 kB
Release files / blizzardapi2-5.0.0.tar.gz
| Download URL | blizzardapi2-5.0.0.tar.gz |
|---|---|
| Size | 108.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d0ff51aa902831e05ef372c93dcca66dfda5d3949751bbaf233a5b12750e5d26
|
|
BLAKE2b-256 checksum How to use checksums |
9231394b486443973b560dcad60f31e85f90c470896743d88ca7cb13db6a42c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / blizzardapi2-5.0.0-py3-none-any.whl
| Download URL | blizzardapi2-5.0.0-py3-none-any.whl |
|---|---|
| Size | 30.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64905b1bd3b559e3ef6636c909a2517fa18e04a06a333ab486e797fba37710ac
|
|
BLAKE2b-256 checksum How to use checksums |
3b82a53a4b67a716721bbcd23c681cb6add4c8cf00f151a7c96d8e658398e467
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for blizzardapi2 5.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.