API Reference

Requests

The wynn.requests module contains internal utilities used by wynn.py. Most importantly it contains the ObjectFromDict class which is used to convert dicts to objects.

class wynn.requests.ObjectFromDict(data)

Recursively wraps a dict in a Python object.

Example use:

>>> o = ObjectFromDict({'foo': 'bar'})
>>> o.foo
'bar'
Parameters:data (dict) – The parsed JSON data from the Wynncraft API

Player

wynn.player.getPlayer(name)

Gets a Player object from the Wynncraft API.

Format: https://docs.wynncraft.com/Player-API/#player-object

Parameters:name (str) – The name of the Player
Returns:The Player returned by the API
Return type:Player
class wynn.player.Player(data)

Contains Player data in the Wynncraft API format.

Format: https://docs.wynncraft.com/Player-API/#player-object

Parameters:

data (dict) – The parsed JSON data from the Wynncraft API

Variables:
  • classesDict (dict) – A dict containing key-value pairs of character class name → character class object
  • classNames (list) – A list containing the names of the player’s character classes

Guild

wynn.guild.getGuilds()

Gets a list of guild names from the Wynncraft API.

Returns:A list of str containing the names of all Wynncraft guilds.
Return type:list
wynn.guild.getGuild(name)

Gets a guild’s information from the Wynncraft API.

Format: https://docs.wynncraft.com/Guild-API/#guild-object

Parameters:name (str) –
Returns:The information of the guild as returned by the API
Return type:Guild
class wynn.guild.Guild(data)

Contains Guild data in the Wynncraft API format.

Format: https://docs.wynncraft.com/Guild-API/#guild-object

Parameters:data (dict) – The parsed JSON data from the Wynncraft API
Variables:owner (ObjectFromDict) – The owner member of this guild

Ingredient

wynn.ingredient.getIngredientNames()

Gets a list of str objects containing all ingredient names from the Wynncraft API.

Returns:A list of all ingredient names as str
Return type:list
wynn.ingredient.getIngredient(name)

Gets an Ingredient as an ObjectFromDict object from the Wynncraft API.

Format: https://docs.wynncraft.com/Ingredient-API/#ingredient-object

Parameters:name (str) – The name of the Ingredient
Returns:The Ingredient returned by the API
Return type:ObjectFromDict
wynn.ingredient.searchIngredients(query, args)

Searches for ingredients from the Wynncraft API. See https://docs.wynncraft.com/Ingredient-API/#search for query format.

Parameters:
  • query (str) – See above link
  • args (str) – See above link
Returns:

A list of ingredients as ObjectFromDict

Return type:

list

Recipe

wynn.recipe.getRecipeIDs()

Gets a list of str objects containing all recipe IDs from the Wynncraft API.

Returns:A list of all recipeIDs as str
Return type:list
wynn.recipe.getRecipe(id)

Gets a Recipe as an ObjectFromDict object from the Wynncraft API.

Format: https://docs.wynncraft.com/Recipe-API/#recipe-object

Parameters:name (str) – The ID of the Recipe
Returns:The Recipe returned by the API
Return type:ObjectFromDict
wynn.recipe.searchRecipes(query, args)

Searches for recipes from the Wynncraft API. See https://docs.wynncraft.com/Recipe-API/#search for query format.

Parameters:
  • query (str) – See above link
  • args (str) – See above link
Returns:

A list of recipes as ObjectFromDict

Return type:

list

Network

wynn.network.getServers()

Gets the currently active servers and the players on them.

Format: https://docs.wynncraft.com/Network-API/#server-list

Returns:A dict of lists by server name containing the names of the players connected to that server
Return type:dict
wynn.network.getPlayerSum()

Gets the current number of players on the Wynncraft network.

Returns:The number of players on the Wynncraft network
Return type:int

Leaderboard

wynn.leaderboard.getGuildLeaderboard(timeframe=None)

Gets a guild leaderboard from Wynncraft.

Parameters:timeframe

A time frame to get the leaderboard from. If None, 'alltime' will be used.

Note

The format is not disclosed in the Wynncraft API documentation

Returns:A list of guild leaderboard objects (Format: https://docs.wynncraft.com/Leaderboard-API/#guild-leaderboard-object) as ObjectFromDict
Return type:list
wynn.leaderboard.getPlayerLeaderboard(timeframe=None)

Gets a player leaderboard from Wynncraft.

Parameters:timeframe

A time frame to get the leaderboard from. If None, 'alltime' will be used.

Note

The format is not disclosed in the Wynncraft API documentation

Returns:A list of player leaderboard objects (Format: https://docs.wynncraft.com/Leaderboard-API/#player-leaderboard-object) as ObjectFromDict
Return type:list
wynn.leaderboard.getPVPLeaderboard(timeframe=None)

Gets a player leaderboard from Wynncraft sorted by PvP kills.

Parameters:timeframe

A time frame to get the leaderboard from. If None, 'alltime' will be used.

Note

The format is not disclosed in the Wynncraft API documentation

Returns:A list of player leaderboard objects (Format: https://docs.wynncraft.com/Leaderboard-API/#player-leaderboard-object) as ObjectFromDict
Return type:list

Territory

wynn.territory.getTerritories()

Gets a list of all territories.

Territory format: https://docs.wynncraft.com/Territory-API/#territory-object

Returns:A list of ObjectFromDict representing every territory
Return type:list

Search

wynn.search.search(name)

Searches for guild and player names containing the search string.

Parameters:name (str) – The name to search
Returns:An object with attribute guilds containing guild name results and players containing player name results
Return type:ObjectFromDict

Item

wynn.item.searchItem(*, name=None, category=None)

Searches for items. If a name is provided, will return a list of all items whose names contain the provided name (case insensitive). Otherwise, if a category is provided, will return a list of items of that type.

Note

This means that if both are provided, this function will only return items by name.

Parameters:
  • name (str) – A name to search for
  • category (str) – An item category to search for
Returns:

A list of items as ObjectFromDict

Return type:

list