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)

Wraps a dict in a Python object.

Example use:

>>> o = ObjectFromDict({'foo': 'bar'})
>>> o.foo
'bar'
>>> o['foo']
'bar'
Parameters:data (dict) – Parsed JSON data

Player

wynn.player.get_player(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 or None if not found
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.get_guilds()

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.get_guild(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 or None if not found
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.get_ingredient_names()

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.get_ingredient(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 or None if not found
Return type:ObjectFromDict
wynn.ingredient.search_ingredients(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. Empty if the query fails.

Return type:

list

Recipe

wynn.recipe.get_recipe_ids()

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.get_recipe(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.search_recipes(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. Empty if the query failed.

Return type:

list

Network

wynn.network.get_servers()

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.get_player_sum()

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.get_guild_leaderboard(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.get_player_leaderboard(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.get_pvp_leaderboard(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.get_territories()

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. The lists are empty if the query failed.
Return type:ObjectFromDict

Item

wynn.item.search_item(*, 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