Package: get-wow-data
get-wow-dataget-wow-dataimplements 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.importgetwowdataasgwdfromdotenvimportload_dotenv#get wow_api_id and wow_api_secret from .env#or pass as kwargs into WowApi()load_dotenv()total_value=0us_api=gwd.WowApi('us','en_US')#region, language (optional)winterhoof_auctions=us_api.get_auctions(4)#4 = Winterhoof's connected realm idforiteminwinterhoof_auctions['auctions']:ifitem.get('unit_price'):total_value+=item.get('unit_price')elifitem.get('buyout'):total_value+=item.get('buyout')elifitem.get('bid'):total_value+=item.get('bid')print(gwd.as_gold(total_value))#prints 430,846,968g 67s 00cFeaturesSupported APIs. (seethisfor a complete list of APIs provided by blizzard not all are callable by get-wow-data)Connected RealmsItemsIconsAuctionsProfessionsRecipesIconsWow TokenInstallingGetwowdata is avilable on PyPi:$python-mpipinstallgetwowdataSetupTo access any blizzard API you need a Client Id and Client Secret.Go tohttps://develop.battle.net/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 APIsRemember not to commit your wow_api_secret!You can set wow_api_id and wow_api_secret as environment variables andget-wow-datawill read these credentials from there.Setting the client id and secret as an environment variableInstall dotenv with pippython -m pip install dotenvCreate a file called .envSet wow_api_id andwow_api_secretwow_api_id = x
wow_api_secret = yTo load environment variables from .envimportosfromdotenvimportload_dotenvload_dotenv()os.environ['env_key':'env_value']APISeedocumentation sitefor the API.Notes on the dataVisithttps://develop.battle.net/documentation/world-of-warcraftfor blizzard official documentation.
Below are notes that i've gathered from the documentation, reading the returned data, and
from forum posts/reddit.Reading jsonUsing a normal print() on response.json() outputs gibberish.
I recommend either the pprint module or viewing the json fromthis listof all the available APIs.Href'sThe href's in the json are links to related elements. One of the links will be to the url that produced that data.PricesThe 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_priceStackable items have a single unit_price while unique items like weapons have a bid/buyout price.Item bonus listThe 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 onwowhead. Mouse over select version and pick your desired version from the drop down menu.Item contextWhere the item was created. Incomplete listContextValue1Normal Dungeon5Heroic Raid11Quest Reward14Vendor15Black MarketItem modifiersStubParameter CheatsheetIncomplete listRegionNamespacelocale (language)usstatic-{region}en_USeudynamic-{region}es_MXkrprofile-{region}pt_BRtwde_DEcnen_GBes_ESfr_FRit_ITru_RUko_KRzh_TWzh_CNFeedbackFeel free tofile an issue.I'm currently teaching myself how to code, so, if you have any suggestions or corrections I would really appriciate it.LicenseMITRelated projectI was writing this formy WoW profession profit calculatorsite.Hopefully you'll find this useful!