Skip to main content

Provides methods that make requests to specific World of Warcraft API's

Project description

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.

  1. Go to https://develop.battle.net/
  2. Click on Get started and login.
  3. Now click create client and fill out the form.
  4. 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

  1. Install dotenv with pip
python -m pip install dotenv
  1. Create a file called .env
  2. Set wow_api_id andwow_api_secret
wow_api_id = x
wow_api_secret = y
  1. To load environment variables from .env
import os
from dotenv import load_dotenv

load_dotenv()

os.environ['env_key': 'env_value']

API

See documentation site for the API.

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.

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

Related project

I was writing this for my WoW profession profit calculator site.

Hopefully you'll find this useful!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

get-wow-data-0.1.7.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

get_wow_data-0.1.7-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file get-wow-data-0.1.7.tar.gz.

File metadata

  • Download URL: get-wow-data-0.1.7.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.1

File hashes

Hashes for get-wow-data-0.1.7.tar.gz
Algorithm Hash digest
SHA256 4461efba9f7d28d1af167ff2e53e139498dc6b4a2cdce7dabe1cf51d26d1133f
MD5 f05c547ff7417c352b040d7e23d4a332
BLAKE2b-256 6376522519711d18558e8fa406e99c1281afc8738214ace2cc4b6a031ee0252d

See more details on using hashes here.

File details

Details for the file get_wow_data-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for get_wow_data-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5c05cf3b150d9059676cb75e85f164db95dafcbe6c957515c7762f9a6b149afc
MD5 6b362891c7d0d6a3165b7c5ac7d23f44
BLAKE2b-256 3468c195de71352abb98d8a0a5a8e72ab093765371a001019ac6b3bd5e7e8be9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page