How to Find Pet IDs for desired_pets.json in Azeroth Auction Assassin

To find pet IDs for desired_pets.json, search the cached StaticData/pet_names.json file by pet name to retrieve the integer ID, or use the get_petnames() function in utils/api_requests.py to query Blizzard's live Pet Index API.

The Azeroth Auction Assassin is an open-source market analysis tool for World of Warcraft auctions. Configuring desired_pets.json requires mapping specific pet IDs to your maximum purchase price, but these numeric identifiers are not always obvious. This guide explains how the application resolves pet names to IDs and shows you exactly where to find them using the repository's built-in utilities and static data files.

Understanding the desired_pets.json Format

The desired_pets.json file expects a JSON object where keys are pet IDs (integers formatted as strings) and values are maximum prices (floats representing gold values). For example, to set a maximum bid of 2700 gold for Sophic Amalgamation (ID 3390) and 1500 gold for Cubbly (ID 3415), your configuration would look like this:

{
  "3390": 2700,
  "3415": 1500
}

Note that while the ID represents an integer, it must be formatted as a string key in JSON, while the price should be a number (integer or float).

How Azeroth Auction Assassin Resolves Pet IDs

The application retrieves correct pet ID mappings through three integrated sources. When the program starts, the MegaData.__init__ method in utils/mega_data_setup.py attempts to populate self.PET_NAMES using the following fallback chain:

  • Blizzard Pet Index API: The primary source calls get_petnames() from utils/api_requests.py, which queries Blizzard's live API and returns a dictionary mapping {pet_id: pet_name}.
  • Static Backup File: If the live API request fails, the system falls back to get_pet_names_backup() from the same module, which loads a cached snapshot from StaticData/pet_names.json.
  • User Configuration: When loading your desired_pets.json, the __set_desired_items() method validates that the IDs you provided exist in the self.PET_NAMES dictionary.

Step-by-Step Guide to Finding Pet IDs

Follow these steps to locate the correct integer ID for any battle pet:

  1. Check the cached list – Open StaticData/pet_names.json in the repository root. This file contains a complete snapshot of all pet IDs. Search for the pet name; the associated key is the pet ID you need.

  2. Query Blizzard's API (optional) – If you need the most current data or cannot access the repository files, use the get_petnames() function with a valid OAuth token to retrieve live mappings.

  3. Verify the ID – Ensure the ID is an integer. Place it as the key in your desired_pets.json file, with your maximum price as the value.

Code Examples for Pet ID Lookup

Query Live Blizzard API

Use this script to fetch current pet mappings directly from Blizzard's servers. You will need a valid WOW_CLIENT_ID and WOW_CLIENT_SECRET from the Blizzard Developer Portal.


# find_pet_id.py

import os
from utils.api_requests import get_wow_access_token, get_petnames

client_id = os.getenv("WOW_CLIENT_ID")
client_secret = os.getenv("WOW_CLIENT_SECRET")

access_token = get_wow_access_token(client_id, client_secret)
pet_dict = get_petnames(access_token)  # Returns {3390: "Sophic Amalgamation", ...}

def find_pet_id(name):
    for pid, pname in pet_dict.items():
        if pname.lower() == name.lower():
            return pid
    return None

print(find_pet_id("Sophic Amalgamation"))  # Output: 3390

Search Local Static Data

If you lack API credentials or internet access, query the local cache directly:

from utils.api_requests import get_pet_names_backup

pet_dict = get_pet_names_backup()  # Loads StaticData/pet_names.json

def find_pet_id(name):
    return next(
        (pid for pid, pname in pet_dict.items() if pname.lower() == name.lower()),
        None
    )

print(find_pet_id("Cubbly"))  # Output: 3415

Generate desired_pets.json Programmatically

Automate the creation of your configuration file by mapping pet names to prices:

import json
import os
from utils.api_requests import get_wow_access_token, get_petnames

def build_desired_pets(pet_requests, client_id, client_secret, out_path):
    token = get_wow_access_token(client_id, client_secret)
    pet_dict = get_petnames(token)
    
    desired = {}
    for name, max_price in pet_requests.items():
        pid = next(
            (p for p, n in pet_dict.items() if n.lower() == name.lower()),
            None
        )
        if pid is None:
            raise ValueError(f"Unknown pet name: {name}")
        desired[str(pid)] = float(max_price)
    
    with open(out_path, "w") as f:
        json.dump(desired, f, indent=2)

# Example usage

build_desired_pets(
    {"Sophic Amalgamation": 2700, "Cubbly": 1500},
    os.getenv("WOW_CLIENT_ID"),
    os.getenv("WOW_CLIENT_SECRET"),
    "desired_pets.json"
)

Key Implementation Files

Understanding where the application handles pet ID resolution helps when troubleshooting or extending functionality:

  • utils/api_requests.py – Contains get_wow_access_token(), get_petnames(), and get_pet_names_backup(). These functions handle OAuth authentication and retrieve the pet ID mappings from either Blizzard's live API or the local cache.

  • utils/mega_data_setup.py – Implements the MegaData class, including __init__ and __set_desired_items(). This is where the application loads your desired_pets.json and validates the pet IDs against the internal self.PET_NAMES dictionary.

  • StaticData/pet_names.json – A complete cached snapshot of all World of Warcraft battle pet IDs and names. This file serves as the offline fallback when API requests fail.

  • example_desired_pets.json – A template file demonstrating the correct JSON structure for user configurations.

Summary

  • desired_pets.json requires integer pet IDs as keys mapped to your maximum gold price as values.
  • The repository provides three lookup methods: Blizzard's live API via get_petnames(), the static cache at StaticData/pet_names.json, and runtime validation in mega_data_setup.py.
  • For offline workflows, use get_pet_names_backup() to read the cached pet list without API credentials.
  • Always verify IDs are valid integers before adding them to your configuration to ensure the Assassin recognizes your targets.

Frequently Asked Questions

What format does desired_pets.json require?

The file must contain a JSON object where keys are pet IDs as strings (representing integers) and values are numbers representing the maximum gold you will pay. For example, "3390": 2700 sets a 2700 gold limit for pet ID 3390 (Sophic Amalgamation). The application reads this file during initialization in utils/mega_data_setup.py to build your target list.

Where does Azeroth Auction Assassin get pet ID data?

According to the source code in utils/mega_data_setup.py, the application first attempts to fetch live data using get_petnames() from utils/api_requests.py. If the Blizzard API is unreachable, it automatically falls back to get_pet_names_backup(), which loads the static snapshot from StaticData/pet_names.json. This ensures the pet database is available even during API outages.

Can I find pet IDs without an internet connection?

Yes. The repository includes StaticData/pet_names.json, a complete cached list of all pet IDs and names. You can search this file directly for the pet name to find its ID, or use the get_pet_names_backup() function in a local Python script to query this offline dataset without requiring API credentials or network access.

What happens if I use an invalid pet ID?

When the application loads desired_pets.json, the __set_desired_items() method in utils/mega_data_setup.py validates each ID against the self.PET_NAMES dictionary. If you provide an ID that does not exist in the current pet database, the validation will fail and the application will not recognize that entry as a valid auction target, effectively ignoring it during market scans.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →