get-wow-data¶
get-wow-data implements requests to the World of Warcraft (WoW) APIs so you don’t have to.
Example: Get the value of all auctions from the Winterhoof server.
import getwowdata as gwd
from dotenv import load_dotenv
#get wow_api_id and wow_api_secret from .env
#or pass as kwargs into WowApi()
load_dotenv()
total_value = 0
us_api = gwd.WowApi('us', 'en_US') #region, language (optional)
winterhoof_auctions = us_api.get_auctions(4) #4 = Winterhoof's connected realm id
for item in winterhoof_auctions['auctions']:
if item.get('unit_price'):
total_value += item.get('unit_price')
elif item.get('buyout'):
total_value += item.get('buyout')
elif item.get('bid'):
total_value += item.get('bid')
print(gwd.as_gold(total_value))
#prints 430,846,968g 67s 00c
Features¶
Supported APIs. (see this for a complete list of APIs provided by blizzard not all are callable by get-wow-data)
Connected Realms
Items
Icons
Auctions
Professions
Recipes
Icons
Wow Token
Installing¶
Getwowdata is avilable on PyPi:
$ python -m pip install getwowdata
Setup¶
To access any blizzard API you need a Client Id and Client Secret.
Click on Get started and login.
Now click create client and fill out the form.
You now have a Client Id and Client Secret to query Blizzards APIs
Remember not to commit your wow_api_secret! You can set wow_api_id and wow_api_secret as environment variables and get-wow-data will read these credentials from there.
Setting the client id and secret as an environment variable¶
Install dotenv with pip
python -m pip install dotenv
Create a file called .env
Set wow_api_id andwow_api_secret
wow_api_id = x
wow_api_secret = y
To load environment variables from .env
import os
from dotenv import load_dotenv
load_dotenv()
os.environ['env_key': 'env_value']
API¶
There are two ways to consume the World of Warcraft APIs search or get methods. Both types of methods require similar data like an access token, region, … the WowApi class contains that data.
Search¶
Blizzard provides search for some of their APIs. Meaning that the API can be filtered by any of the data’s fields.
Example: Searching for thunderfury.
from pprint import pprint
from dotenv import load_dotenv
from getwowdata import WowApi
load_dotenv()
eu_api = WowApi('eu', 'en_US')
params = {"name.en_US":"Thunderfury"}
result_item = eu_api.item_search(**params)
pprint(result_item)
#prints thunderfury json data.
#This returns all items that have thunderfury in their name.
Get¶
Most WoW APIs don’t have search functionality provided by blizzard. This means the requests you make to them are restricted to specific fields usually an id.
us_api = WowApi('us', 'en_US')
wow_token_data = us_api.get_wow_token()
pprint(wow_token_data)
#prints:
# {'_links': {'self': {'href': 'https://us.api.blizzard.com/data/wow/token/?namespace=dynamic-us'}},
# 'last_updated_timestamp': 1653847530000,
# 'price': 1656890000}
- class getwowdata.HTTPAdapter(pool_connections=10, pool_maxsize=10, max_retries=0, pool_block=False)¶
The built-in HTTP Adapter for urllib3.
Provides a general-case interface for Requests sessions to contact HTTP and HTTPS urls by implementing the Transport Adapter interface. This class will usually be created by the
Session
class under the covers.- Parameters
pool_connections – The number of urllib3 connection pools to cache.
pool_maxsize – The maximum number of connections to save in the pool.
max_retries – The maximum number of retries each connection should attempt. Note, this applies only to failed DNS lookups, socket connections and connection timeouts, never to requests where data has made it to the server. By default, Requests does not retry failed connections. If you need granular control over the conditions under which we retry a request, import urllib3’s
Retry
class and pass that instead.pool_block – Whether the connection pool should block for connections.
Usage:
>>> import requests >>> s = requests.Session() >>> a = requests.adapters.HTTPAdapter(max_retries=3) >>> s.mount('http://', a)
- add_headers(request, **kwargs)¶
Add any headers needed by the connection. As of v2.0 this does nothing by default, but is left for overriding by users that subclass the
HTTPAdapter
.This should not be called from user code, and is only exposed for use when subclassing the
HTTPAdapter
.- Parameters
request – The
PreparedRequest
to add headers to.kwargs – The keyword arguments from the call to send().
- build_response(req, resp)¶
Builds a
Response
object from a urllib3 response. This should not be called from user code, and is only exposed for use when subclassing theHTTPAdapter
- Parameters
req – The
PreparedRequest
used to generate the response.resp – The urllib3 response object.
- Return type
requests.Response
- cert_verify(conn, url, verify, cert)¶
Verify a SSL certificate. This method should not be called from user code, and is only exposed for use when subclassing the
HTTPAdapter
.- Parameters
conn – The urllib3 connection object associated with the cert.
url – The requested URL.
verify – Either a boolean, in which case it controls whether we verify the server’s TLS certificate, or a string, in which case it must be a path to a CA bundle to use
cert – The SSL certificate to verify.
- close()¶
Disposes of any internal state.
Currently, this closes the PoolManager and any active ProxyManager, which closes any pooled connections.
- get_connection(url, proxies=None)¶
Returns a urllib3 connection for the given URL. This should not be called from user code, and is only exposed for use when subclassing the
HTTPAdapter
.- Parameters
url – The URL to connect to.
proxies – (optional) A Requests-style dictionary of proxies used on this request.
- Return type
urllib3.ConnectionPool
- init_poolmanager(connections, maxsize, block=False, **pool_kwargs)¶
Initializes a urllib3 PoolManager.
This method should not be called from user code, and is only exposed for use when subclassing the
HTTPAdapter
.- Parameters
connections – The number of urllib3 connection pools to cache.
maxsize – The maximum number of connections to save in the pool.
block – Block when no free connections are available.
pool_kwargs – Extra keyword arguments used to initialize the Pool Manager.
- proxy_headers(proxy)¶
Returns a dictionary of the headers to add to any request sent through a proxy. This works with urllib3 magic to ensure that they are correctly sent to the proxy, rather than in a tunnelled request if CONNECT is being used.
This should not be called from user code, and is only exposed for use when subclassing the
HTTPAdapter
.- Parameters
proxy – The url of the proxy being used for this request.
- Return type
dict
- proxy_manager_for(proxy, **proxy_kwargs)¶
Return urllib3 ProxyManager for the given proxy.
This method should not be called from user code, and is only exposed for use when subclassing the
HTTPAdapter
.- Parameters
proxy – The proxy to return a urllib3 ProxyManager for.
proxy_kwargs – Extra keyword arguments used to configure the Proxy Manager.
- Returns
ProxyManager
- Return type
urllib3.ProxyManager
- request_url(request, proxies)¶
Obtain the url to use when making the final request.
If the message is being sent through a HTTP proxy, the full URL has to be used. Otherwise, we should only use the path portion of the URL.
This should not be called from user code, and is only exposed for use when subclassing the
HTTPAdapter
.- Parameters
request – The
PreparedRequest
being sent.proxies – A dictionary of schemes or schemes and hosts to proxy URLs.
- Return type
str
- send(request, stream=False, timeout=None, verify=True, cert=None, proxies=None)¶
Sends PreparedRequest object. Returns Response object.
- Parameters
request – The
PreparedRequest
being sent.stream – (optional) Whether to stream the request content.
timeout (float or tuple or urllib3 Timeout object) – (optional) How long to wait for the server to send data before giving up, as a float, or a (connect timeout, read timeout) tuple.
verify – (optional) Either a boolean, in which case it controls whether we verify the server’s TLS certificate, or a string, in which case it must be a path to a CA bundle to use
cert – (optional) Any user-provided SSL certificate to be trusted.
proxies – (optional) The proxies dictionary to apply to the request.
- Return type
requests.Response
- class getwowdata.Retry(total=10, connect=None, read=None, redirect=None, status=None, other=None, allowed_methods=<object object>, status_forcelist=None, backoff_factor=0, raise_on_redirect=True, raise_on_status=True, history=None, respect_retry_after_header=True, remove_headers_on_redirect=<object object>, method_whitelist=<object object>)¶
Retry configuration.
Each retry attempt will create a new Retry object with updated values, so they can be safely reused.
Retries can be defined as a default for a pool:
retries = Retry(connect=5, read=2, redirect=5) http = PoolManager(retries=retries) response = http.request('GET', 'http://example.com/')
Or per-request (which overrides the default for the pool):
response = http.request('GET', 'http://example.com/', retries=Retry(10))
Retries can be disabled by passing
False
:response = http.request('GET', 'http://example.com/', retries=False)
Errors will be wrapped in
MaxRetryError
unless retries are disabled, in which case the causing exception will be raised.- Parameters
total (int) –
Total number of retries to allow. Takes precedence over other counts.
Set to
None
to remove this constraint and fall back on other counts.Set to
0
to fail on the first retry.Set to
False
to disable and implyraise_on_redirect=False
.connect (int) –
How many connection-related errors to retry on.
These are errors raised before the request is sent to the remote server, which we assume has not triggered the server to process the request.
Set to
0
to fail on the first retry of this type.read (int) –
How many times to retry on read errors.
These errors are raised after the request was sent to the server, so the request may have side-effects.
Set to
0
to fail on the first retry of this type.redirect (int) –
How many redirects to perform. Limit this to avoid infinite redirect loops.
A redirect is a HTTP response with a status code 301, 302, 303, 307 or 308.
Set to
0
to fail on the first retry of this type.Set to
False
to disable and implyraise_on_redirect=False
.status (int) –
How many times to retry on bad status codes.
These are retries made on responses, where status code matches
status_forcelist
.Set to
0
to fail on the first retry of this type.other (int) –
How many times to retry on other errors.
Other errors are errors that are not connect, read, redirect or status errors. These errors might be raised after the request was sent to the server, so the request might have side-effects.
Set to
0
to fail on the first retry of this type.If
total
is not set, it’s a good idea to set this to 0 to account for unexpected edge cases and avoid infinite retry loops.allowed_methods (iterable) –
Set of uppercased HTTP method verbs that we should retry on.
By default, we only retry on methods which are considered to be idempotent (multiple requests with the same parameters end with the same state). See
Retry.DEFAULT_ALLOWED_METHODS
.Set to a
False
value to retry on any verb.Warning
Previously this parameter was named
method_whitelist
, that usage is deprecated in v1.26.0 and will be removed in v2.0.status_forcelist (iterable) –
A set of integer HTTP status codes that we should force a retry on. A retry is initiated if the request method is in
allowed_methods
and the response status code is instatus_forcelist
.By default, this is disabled with
None
.backoff_factor (float) –
A backoff factor to apply between attempts after the second try (most errors are resolved immediately by a second try without a delay). urllib3 will sleep for:
{backoff factor} * (2 ** ({number of total retries} - 1))
seconds. If the backoff_factor is 0.1, then
sleep()
will sleep for [0.0s, 0.2s, 0.4s, …] between retries. It will never be longer thanRetry.DEFAULT_BACKOFF_MAX
.By default, backoff is disabled (set to 0).
raise_on_redirect (bool) – Whether, if the number of redirects is exhausted, to raise a MaxRetryError, or to return a response with a response code in the 3xx range.
raise_on_status (bool) – Similar meaning to
raise_on_redirect
: whether we should raise an exception, or return a response, if status falls instatus_forcelist
range and retries have been exhausted.history (tuple) – The history of the request encountered during each call to
increment()
. The list is in the order the requests occurred. Each list item is of classRequestHistory
.respect_retry_after_header (bool) – Whether to respect Retry-After header on status codes defined as
Retry.RETRY_AFTER_STATUS_CODES
or not.remove_headers_on_redirect (iterable) – Sequence of headers to remove from the request when a response indicating a redirect is returned before firing off the redirected request.
- DEFAULT_ALLOWED_METHODS = frozenset({'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'TRACE'})¶
Default methods to be used for
allowed_methods
- DEFAULT_BACKOFF_MAX = 120¶
Maximum backoff time.
- DEFAULT_REMOVE_HEADERS_ON_REDIRECT = frozenset({'Authorization'})¶
Default headers to be used for
remove_headers_on_redirect
- RETRY_AFTER_STATUS_CODES = frozenset({413, 429, 503})¶
Default status codes to be used for
status_forcelist
- classmethod from_int(retries, redirect=True, default=None)¶
Backwards-compatibility for the old retries format.
- get_backoff_time()¶
Formula for computing the current backoff
- Return type
float
- get_retry_after(response)¶
Get the value of Retry-After in seconds.
- increment(method=None, url=None, response=None, error=None, _pool=None, _stacktrace=None)¶
Return a new Retry object with incremented retry counters.
- Parameters
response (
HTTPResponse
) – A response object, or None, if the server did not return a response.error (Exception) – An error encountered during the request, or None if the response was received successfully.
- Returns
A new
Retry
object.
- is_exhausted()¶
Are we out of retries?
- is_retry(method, status_code, has_retry_after=False)¶
Is this method/status code retryable? (Based on allowlists and control variables such as the number of total retries to allow, whether to respect the Retry-After header, whether this header is present, and whether the returned status code is on the list of status codes to be retried upon on the presence of the aforementioned header)
- sleep(response=None)¶
Sleep between retry attempts.
This method will respect a server’s
Retry-After
response header and sleep the duration of the time requested. If that is not present, it will use an exponential backoff. By default, the backoff factor is 0 and this method will return immediately.
- class getwowdata.WowApi(region: str, locale: Optional[str] = None, wow_api_id: Optional[str] = None, wow_api_secret: Optional[str] = None)¶
Creates an object with access_key, region, and, optionally, locale attributes.
- region¶
Ex: ‘us’. The region where the data will come from. See https://develop.battle.net/documentation/guides/regionality-and-apis
- Type
str
- locale¶
Ex: ‘en_US’. The language data will be returned in. See https://develop.battle.net/documentation/world-of-warcraft/guides/localization. Default = None.
- Type
str, optional
- wow_api_id¶
Required to recieve an access token to query Blizzard APIs. Can be loaded from environment variables. See Setup in readme or visit https://develop.battle.net/ and click get started now. Default = None.
- Type
str, optional
- wow_api_secret¶
Required to recieve an access token to query Blizzard APIs. Can be loaded from environment variables. See Setup in readme or visit https://develop.battle.net/ and click get started now. Default = None.
- Type
str, optional
- connected_realm_search(**extra_params: dict) dict ¶
Uses the connected realms API’s search functionaly for more specific queries.
Searches can filter by fields returned from the API. Ex: filerting realms by slug == illidan. Below is the data returned from a regular realm query.
- {
“page”: 1, “pageSize”: 58, “maxPageSize”: 100, “pageCount”: 1, “results”: [ {
…
}, “data”: {
- “realms”: {
… “slug”:”illidan”
}
To only return the realm with the slug == illidan pass {‘data.realms.slug’:’illidan’} into **extra_params. See https://develop.battle.net/documentation/world-of-warcraft/guides/search for more details on search.
- Parameters
**extra_params (int/str, optional) – Returned data can be filtered by any of its fields. Useful parameters are listed below. Parameters must be sent as a dictionary where keys are str and values are str or int like {‘_page’: 1, ‘realms.slug’:’illidan’, …}
**timeout (int, optional) – How long (in seconds) until the request to the API timesout Default = 30 seconds. Ex: {‘timeout’: 10}
**_pageSize (int, optional) – Number of entries in a result page. Default = 100, min = 1, max = 1000. Ex: {“_pageSize”: 2}
**_page (int, optional) – The page number that will be returned. Default = 1. Ex: {“_page”: 1}
**orderby (str, optional) – Accepts a comma seperated field of elements to sort by. See https://develop.battle.net/documentation/world-of-warcraft/guides/search. Ex: {“orderby”:”data.required_level”}
**data.realms.slug (str, optional) – All realm slugs must be lowercase with spaces converted to dashes (-)
Returns: A json looking dict with nested dicts and/or lists containing data from the API.
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
requests.exceptions.ConnectionError – Raised on network problem.
- get_auctions(connected_realm_id, timeout=30) dict ¶
Gets all auctions from a realm by its connected_realm_id.
- Parameters
connected_realm_id (int) – The connected realm id. Get from connected_realm_index() or use connected_realm_search().
timeout (int) – How long until the request to the API timesout in seconds. Default: 30 seconds.
- Returns
A json looking dict with nested dicts and/or lists containing data from the API.
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- get_connected_realm_index(timeout=30) dict ¶
Returns a dict where {key = Realm name: value = connected realm id, …}
- Parameters
timeout (int) – How long until the request to the API timesout in seconds. Default: 30 seconds.
- Returns
connected_realm_id}
- Return type
A dict like {realm_name
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- get_connected_realms_by_id(connected_realm_id: int, timeout: int = 30) dict ¶
Gets all the realms that share a connected_realm id.
- Parameters
connected_realm_id (int) – The connected realm id. Get from connected_realm_index().
timeout (int) – How long (in seconds) until the request to the API timesout Default = 30 seconds.
- Returns
A json looking dict with nested dicts and/or lists containing data from the API.
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- get_item_bonuses(timeout=30) dict ¶
Returns a dict containing the item bonuses from raidbots.com.
- Parameters
timeout (int) – How long until the request to the API timesout in seconds. Default: 30 seconds.
- Returns
A json looking dict with nested dicts and/or lists containing data from raidbots.com
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- get_item_classes(timeout=30) dict ¶
Returns all item classes (consumable, container, weapon, …).
- Parameters
access_token (str) – Returned from get_access_token().
timeout (int) – How long until the request to the API timesout in seconds. Default: 30 seconds.
- Returns
A json looking dict with nested dicts and/or lists containing data from the API.
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- get_item_icon(item_id, timeout=30) bytes ¶
Returns the icon for an item in bytes.
- Parameters
item_id (int) – The items id. Get from item_search().
timeout (int) – How long until the request to the API timesout in seconds. Default: 30 seconds.
- Returns
Item icon in bytes.
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- get_item_set_index(timeout=30) dict ¶
Returns all item sets. Ex: teir sets
- Parameters
timeout (int) – How long until the request to the API timesout in seconds. Default: 30 seconds.
- Returns
A json looking dict with nested dicts and/or lists containing data from the API.
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- get_item_subclasses(item_class_id, timeout=30) dict ¶
Returns all item subclasses (class: consumable, subclass: potion, elixir, …).
- Parameters
item_class_id (int) – Item class id. Found with get_item_classes().
timeout (int) – How long until the request to the API timesout in seconds. Default: 30 seconds.
- Returns
A json looking dict with nested dicts and/or lists containing data from the API.
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- get_profession_icon(profession_id, timeout=30) bytes ¶
Returns a profession’s icon in bytes.
- Parameters
profession_id (int) – The profession’s id. Found in get_profession_index().
timeout (int) – How long until the request to the API timesout in seconds. Default: 30 seconds.
- Returns
The profession’s icon in bytes.
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- get_profession_index(timeout=30) dict ¶
Gets all professions including their names and ids.
- Parameters
timeout (int) – How long until the request to the API timesout in seconds. Default: 30 seconds.
- Returns
A json looking dict with nested dicts and/or lists containing data from the API.
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- get_profession_tier_categories(profession_id, skill_tier_id, timeout=30) dict ¶
Returns all crafts from a skill teir.
Included in this response are the categories like belts, capes, … and the within them. This is broken down by skill tier (tbc, draenor, shadowlands).
- Parameters
profession_id (int) – The profession’s id. Found in get_profession_index().
skill_tier_id (int) – The skill teir id. Found in get_profession_teirs().
timeout (int) – How long until the request to the API timesout in seconds. Default: 30 seconds.
- Returns
A json looking dict with nested dicts and/or lists containing data from the API.
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- get_profession_tiers(profession_id, timeout=30) dict ¶
Returns all profession teirs from a profession.
A profession teir includes all the recipes from that expansion. Teir examples are classic, tbc, shadowlands, …
- Parameters
profession_id (int) – The profession’s id. Found in get_profession_index().
timeout (int) – How long until the request to the API timesout in seconds. Default: 30 seconds.
- Returns
A json looking dict with nested dicts and/or lists containing data from the API.
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- get_recipe(recipe_id, timeout=30) dict ¶
Returns a recipes details by its id.
- Parameters
recipe_id (int) – The recipe’s id. Found in get_profession_tier_details().
timeout (int) – How long until the request to the API timesout in seconds. Default: 30 seconds.
- Returns
A json looking dict with nested dicts and/or lists containing data from the API.
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- get_recipe_icon(recipe_id, timeout=30) bytes ¶
Returns a recipes icon in bytes.
- Parameters
recipe_id (int) – The recipe’s id. Found in get_profession_tier_details().
timeout (int) – How long until the request to the API timesout in seconds. Default: 30 seconds.
- Returns
The recipe icon in bytes.
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- get_wow_token(timeout=30) dict ¶
Returns the price of the wow token and the timestamp of its last update.
- Parameters
timeout (int) – How long until the request to the API timesout in seconds. Default: 30 seconds.
- Returns
A json looking dict with nested dicts and/or lists containing data from the API. The price is in the format g*sscc where g=gold, s=silver, and c=copper. Ex: 123456 = 12g 34s 56c
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- item_search(**extra_params: dict) dict ¶
Uses the items API’s search functionality to make more specific queries.
Ex: Filter by required level and name. Below is the data returned from some item search.
{ “page”: 1, “pageSize”: 3, “maxPageSize”: 100, “pageCount”: 1, “results”: [
- {
…
}, “data”: {
“level”: 35, “required_level”: 30,
- …
… name.en_US: Garrosh
To filter by name and level, pass {“required_level”: 30, “name.en_US: “Garrosh”} into **extra_params. Additional parameters must be sent as a dictionary where the keys strings and values are strings or ints.
- Parameters
**extra_params (int/str, optional) – Returned data can be filtered by any of its fields. Useful parameters are listed below. Ex: {‘data.required_level’:35} will only return items where required_level == 35
**timeout (int, optional) – How long (in seconds) until the request to the API timesout Default = 30 seconds. Ex: {‘timeout’: 10}
**_pageSize (int, optional) – Number of entries in a result page. Default = 100, min = 1, max = 1000. Ex: {“_pageSize”: 2}
**_page (int, optional) – The page number that will be returned. Default = 1. Ex: {“_page”: 1}
**orderby (str, optional) – Accepts a comma seperated field of elements to sort by. See https://develop.battle.net/documentation/world-of-warcraft/guides/search. Ex: {“orderby”:”data.required_level”}
**id (int, optional) – An item’s id. Enter in the following format {‘id’: ‘(id_start, id_end)’} to specify a set of id’s. See https://develop.battle.net/documentation/world-of-warcraft/guides/search.
Returns: A json looking dict with nested dicts and/or lists containing data from the API.
- Raises
requests.exceptions.HTTPError – Raised on bad status code. Shows the problem causing error and url.
- getwowdata.as_gold(amount: int) str ¶
Formats a integer as n*g nns nnc where n is some number, g = gold, s = silver, and c = copper.
- Parameters
amount (int) – The value of something in WoW’s currency.
- Returns
A string formatted to WoW’s gold, silver, copper currency.
- getwowdata.convert_to_datetime(last_modified: str)¶
Takes last-modified header and converts it to a datetime object.
- getwowdata.get_id_from_url(url: str) int ¶
Returns the id from a url.
This matches to the first number in a string. As of writing the only number in blizzard’s urls is an id.
- Parameters
url (str) – The url that contains a single number id.
- Returns
The number found in the url.
- getwowdata.load_dotenv(dotenv_path: Optional[Union[str, os.PathLike]] = None, stream: Optional[IO[str]] = None, verbose: bool = False, override: bool = False, interpolate: bool = True, encoding: Optional[str] = 'utf-8') bool ¶
Parse a .env file and then load all the variables found as environment variables.
dotenv_path: absolute or relative path to .env file.
stream: Text stream (such as io.StringIO) with .env content, used if dotenv_path is None.
verbose: whether to output a warning the .env file is missing. Defaults to False.
override: whether to override the system environment variables with the variables in .env file. Defaults to False.
encoding: encoding to be used to read the file.
If both dotenv_path and stream, find_dotenv() is used to find the .env file.
Notes on the data¶
Visit https://develop.battle.net/documentation/world-of-warcraft for blizzard official documentation. Below are notes that i’ve gathered from the documentation, reading the returned data, and from forum posts/reddit.
Reading json¶
Using a normal print() on response.json() outputs gibberish. I recommend either the pprint module or viewing the json from this list of all the available APIs.
Href’s¶
The href’s in the json are links to related elements. One of the links will be to the url that produced that data.
Prices¶
The prices or value of an item is in the following format g*sscc, where g = gold, s = silver, c = copper. Silver and copper are fixed in the last 4 decimal spaces whlie gold can be as any number of spaces before silver. So 25289400 is 2528g 94s 00c.
buyout vs unit_price¶
Stackable items have a single unit_price while unique items like weapons have a bid/buyout price.
Item bonus list¶
The item bonus list are the modifiers applied to an item, such as the level its scaled to. Blizzard does not make the bonus values and their corresponding effects available through an API.
Versions of an item with different bonuses can be found on wowhead. Mouse over select version and pick your desired version from the drop down menu.
Last Modified¶
The date when the API data was last modified is returned as the key ‘last-modified’.
Item context¶
Where the item was created. Incomplete list
Context |
Value |
---|---|
1 |
Normal Dungeon |
5 |
Heroic Raid |
11 |
Quest Reward |
14 |
Vendor |
15 |
Black Market |
Item modifiers¶
Stub
¶
Parameter Cheatsheet¶
Incomplete list
Region |
Namespace |
locale (language) |
---|---|---|
us |
static-{region} |
en_US |
eu |
dynamic-{region} |
es_MX |
kr |
profile-{region} |
pt_BR |
tw |
de_DE |
|
cn |
en_GB |
|
es_ES |
||
fr_FR |
||
it_IT |
||
ru_RU |
||
ko_KR |
||
zh_TW |
||
zh_CN |
Feedback¶
Feel free to file an issue.
I’m currently teaching myself how to code, so, if you have any suggestions or corrections I would really appriciate it.
License¶
MIT