Request Reference¶
It is the aim of pykollib that every action that can be performed through the Kingdom of Loathing web interface is represented as a request in this module. requests handle the two aspects of interacting programmatically with KoL - generating the requisite URL and parsing the HTML response.
Normally to use a request you pass it to the parse method of your Session instance. However, in the case of a bug or to capture something not covered by the parse function, it is possible to carry out these two operations separately.
async def spend_ten_turns_in_canadia_gym():
response = await canadia_gym(session, 10)
# do something else with response
return await response.parse()
As the parsed return type is a result of a different function, the documentation is currently not displaying it, but we’re working on it!
-
class
pykollib.request.
adventure
(session, location_id)¶ A request used to initiate an adventure at any location.
- Parameters
session (
Session
) – Active Sessionlocation_id (
int
) – Id of the location in which to adventure
-
class
pykollib.request.
ascension_history
(session, player_id, pre_ns13=False)¶ Fetches ascension history for a player
- Params player_id
Player for whom to fetch ascension history
- Params pre_ns13
Whether to include pre NS13 ascension history
-
static
parser
(content, **kwargs)¶ Parses through the response and constructs an array of ascensions.
- Return type
List
[Ascension
{id:int
, dropped_path:bool
, level:int
, player_class:str
, moon:str
, turns:int
, familiar:Optional
[str
], familiar_percentage:Optional
[float
], total_familiar:Optional
[str
], total_familiar_percentage:Optional
[float
], restriction:str
, path:Optional
[str
], start:datetime
, end:datetime
}]
-
class
pykollib.request.
autosell_items
(session, items, quantity=1, all=False, keep_one=False)¶ Sells items via the autosell system
-
static
parser
(content, items=[], **kwargs)¶ - Return type
Response
{items:List
[ItemQuantity
{item: Item, quantity:int
}], meat_gained:int
}
-
static
-
class
pykollib.request.
cafe_consume
(session, cafe, item)¶ Purchases items from a cafe.
- Parameters
cafe (
Cafe
) – Cafe to useitem (
Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}) – Item to consume
-
static
parser
(content, **kwargs)¶ - Return type
ResourceGain
{adventures:int
, inebriety:int
, substats:Dict
[str
,int
], stats:Dict
[str
,int
], level:int
, effects:List
[Dict
[str
,Any
]], hp:int
, mp:int
}
Check the current menu at a given cafe.
- Params session
KoL session
- Params cafe
The Cafe from which to get the menu
- Return type
List
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}]
-
class
pykollib.request.
campground_kitchen
(session)¶ Checks state of the kitchen. (Did you wash the dishes?)
- Parameters
session (
Session
) – Active session
-
static
parser
(content, **kwargs)¶ - Return type
Response
{oven:bool
, range:bool
, chef:bool
, shaker:bool
, cocktail:bool
, bartender:bool
, sushi:bool
}
-
class
pykollib.request.
campground_rest
(session)¶ Rests at the player’s campground.
- Parameters
session (
Session
) – Active session
-
class
pykollib.request.
canadia_gym
(session, turns)¶ -
static
parser
(content, **kwargs)¶ - Return type
Response
{substats:Dict
[str
,int
], stats:Dict
[str
,int
], level:int
}
-
static
-
class
pykollib.request.
canadia_mindcontrol
(session, level)¶ -
static
parser
(content, **kwargs)¶ - Return type
bool
-
static
-
class
pykollib.request.
charpane
(session)¶ Requests the user’s character pane.
-
static
parser
(content, **kwargs)¶ - Return type
Dict
[str
,Any
]
-
static
-
class
pykollib.request.
chat_receive
(session, since=0)¶ -
static
parser
(content, **kwargs)¶ - Return type
Response
{msgs:List
[str
], last:int
, delay:int
}
-
returns_json
= True¶
-
static
-
class
pykollib.request.
chat_send
(session, text='')¶ -
static
parser
(content, **kwargs)¶ - Return type
Response
{output:str
, msgs:List
[str
]}
-
returns_json
= True¶
-
static
-
class
pykollib.request.
choice
(session, choice, option)¶ Submit a given option in response to a give choice
- Parameters
session (
Session
) – KoL sessionchoice (
int
) – The id of the choiceoption (
int
) – The number option to submit
-
class
pykollib.request.
clan_accepting_applications
(session)¶ Toggle whether or not the clan accepts new applications.
-
static
parser
(content, **kwargs)¶ - Return type
bool
-
static
-
class
pykollib.request.
clan_apply
(session, clan_id)¶ Apply to a clan
- Parameters
clan_id (
int
) – id of clan
-
static
parser
(content, **kwargs)¶ Formats the clan application response
- Return type
Response
{success:bool
, already_member:bool
}
-
class
pykollib.request.
clan_log
(session)¶ Retrieves the clan activity log.
-
log_patterns
= {re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? faxed in a (?P<monster>.*)$'): <Action.Fax: 2>, re.compile("^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? added (?P<other_username>.*?) \\(#(?P<other_user_id>[0-9]+)\\) to the clan's whitelist\\.$"): <Action.Whitelisted: 4>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? joined another clan\\.$'): <Action.JoinedAnother: 5>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? left the clan\\.$'): <Action.Left: 7>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? was accepted into the clan \\(whitelist\\)$'): <Action.Joined: 6>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? applied to the clan\\.$'): <Action.Applied: 8>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? accepted (?P<other_username>.*?) \\(#(?P<other_user_id>[0-9]+)\\) into the clan\\.$'): <Action.Accepted: 9>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? added (?P<quantity>[0-9]+) (?P<item>.*?)\\.$'): <Action.StashAdded: 10>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? took (?P<quantity>[0-9]+) (?P<item>.*?)\\.$'): <Action.StashTook: 11>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? contributed (?P<amount>[0-9,]+) Meat\\.$'): <Action.StashMeat: 12>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? changed Rank for (?P<other_username>.*?) \\(#(?P<other_user_id>[0-9]+)\\)\\.$'): <Action.ChangedRank: 13>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? changed title for (?P<other_username>.*?) \\(#(?P<other_user_id>[0-9]+)\\)\\. \\((?P<title>.*?)\\)$'): <Action.ChangedTitle: 14>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? opened up (?P<dungeon>.*?)$'): <Action.DungeonOpened: 15>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? (sealed|shut down) (?P<dungeon>.*?)$'): <Action.DungeonClosed: 16>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? recovered (?P<amount>[0-9,]+) Meat from Hobopolis$'): <Action.DungeonMeat: 17>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? fabricated a (?P<item>.*?) at the Floundry\\.$'): <Action.FloundryFabricated: 18>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? added to the hot dog cart supply \\((?P<item>.*?)x(?P<quantity>[0-9]+)\\)\\.$'): <Action.HotDogSupplied: 19>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? ate an? (?P<item>.*?)\\.$'): <Action.HotDogAte: 20>, re.compile('^(?P<username>.*?)(?: \\(#(?P<user_id>[0-9]+)\\))? gave the speakeasy bartender a bad password\\.$'): <Action.SpeakeasyBadPassword: 21>}¶
-
classmethod
parse_clan_log
(raw_log)¶ - Return type
ClanLog
{date:datetime
, action:Action
, user_id:Optional
[int
], username:str
, data:Dict
[str
,str
]}
-
classmethod
parser
(content, **kwargs)¶ - Return type
List
[ClanLog
{date:datetime
, action:Action
, user_id:Optional
[int
], username:str
, data:Dict
[str
,str
]}]
-
-
class
pykollib.request.
clan_member_boot
(session, user_id)¶ Boot member from clan (also removes their whitelist)
-
class
pykollib.request.
clan_raid_log
(session, raid_id)¶ Retrieves on a previous raid.
-
static
center_with_no_link
(tag)¶
-
static
parse_raid_log
(name, id, raid)¶ Parse a single raid’s HTML tree
- Return type
Dict
[str
,Any
]
-
classmethod
parser
(content, **kwargs)¶ - Return type
Dict
[str
,Any
]
-
static
-
class
pykollib.request.
clan_raids_previous
(session, page=0)¶ Retrieves a list of old raid logs, in pages of length 10
-
static
parser
(content, **kwargs)¶ - Return type
Response
{total:int
, raids:List
[Raid
{id:int
, name:str
, start:date
, end:date
}]}
-
static
-
class
pykollib.request.
clan_raids
(session)¶ Retrieves information on all active raids
-
static
dungeon_name_id_from_title
(comment)¶ - Return type
Tuple
[str
,int
]
-
classmethod
parser
(content, **kwargs)¶ - Return type
List
[Dict
[str
,Any
]]
-
static
-
class
pykollib.request.
clan_ranks
(session)¶ -
static
parse_privileges
(container)¶ - Return type
Dict
[str
,Any
]
-
classmethod
parser
(content, **kwargs)¶ - Return type
List
[Dict
[str
,Any
]]
-
static
-
class
pykollib.request.
clan_rumpus_effect
(session, type)¶ Uses an effect giver in the clan rumpus room.
-
static
parser
(content, **kwargs)¶ - Return type
List
[Dict
[str
,Any
]]
-
static
-
class
pykollib.request.
clan_rumpus_gym
(session, stat, turns)¶ Visits the a gym in the clan rumpus room for a specified number of turns
- Parameters
stat (
Stat
) – The stat to trainturns (
int
) – The number of turns to train for
-
static
parser
(content, **kwargs)¶ - Return type
Response
{substats:Dict
[str
,int
], stats:Dict
[str
,int
], level:int
}
-
class
pykollib.request.
clan_rumpus_item
(session, furniture)¶ Uses an item dispenser in the clan rumpus room.
-
static
parser
(content, **kwargs)¶ - Return type
List
[ItemQuantity
{item: Item, quantity:int
}]
-
static
-
class
pykollib.request.
clan_rumpus_meat
(session, furniture)¶ Uses a meat dispenser in the clan rumpus room.
-
static
parser
(content, **kwargs)¶ - Return type
int
-
static
-
class
pykollib.request.
clan_rumpus_sofa
(session, turns=0)¶ Uses the comfy sofa in the clan rumpus room.
-
static
parser
(content, **kwargs)¶ - Return type
Response
{mp:int
, hp:int
}
-
static
-
class
pykollib.request.
clan_rumpus
(session)¶ -
static
parser
(content, **kwargs)¶ - Return type
List
[Furniture
]
-
static
-
class
pykollib.request.
clan_search
(session, query, nameonly=True)¶ -
static
parser
(content, **kwargs)¶
-
static
-
class
pykollib.request.
clan_show
(session, id)¶ Get information about a clan
-
static
parser
(content, **kwargs)¶ - Return type
Dict
[str
,Any
]
-
static
-
class
pykollib.request.
clan_stash_item_add
(session, items)¶ Adds items to the clan’s stash.
-
class
pykollib.request.
clan_stash_item_remove
(session, item_id=0, quantity=0)¶ Take items from the player’s clan stash.
-
class
pykollib.request.
clan_stash_meat_add
(session, quantity)¶ Adds meat to the player’s clan stash.
-
class
pykollib.request.
clan_stash
(session)¶ This class is used to get a list of items in the user’s clan stash.
-
static
parser
(content, **kwargs)¶ - Return type
List
[Dict
[str
,Any
]]
-
static
-
class
pykollib.request.
clan_vip_crimbotree
(session)¶ Uses the Crimbo Tree in the clan VIP room.
-
static
parser
(content, **kwargs)¶ - Return type
List
[ItemQuantity
{item: Item, quantity:int
}]
-
static
-
class
pykollib.request.
clan_vip_klaw
(session)¶ Uses the Deluxe Mr. Klaw in the clan VIP room.
-
static
parser
(content, **kwargs)¶ - Return type
List
[ItemQuantity
{item: Item, quantity:int
}]
-
static
-
class
pykollib.request.
clan_vip_lookingglass
(session)¶ Uses the Looking Glass in the clan VIP room.
-
static
parser
(content, **kwargs)¶ - Return type
List
[ItemQuantity
{item: Item, quantity:int
}]
-
static
-
class
pykollib.request.
clan_whitelist_add
(session, user, rank=0, title='')¶ -
static
parser
(content, **kwargs)¶ - Return type
Response
{success:bool
, already:bool
}
-
static
-
class
pykollib.request.
clan_whitelist_remove
(session, user)¶ -
static
parser
(content, **kwargs)¶ - Return type
bool
-
static
-
class
pykollib.request.
clan_whitelist
(session)¶ Retrieves information from the clan whitelist page.
-
static
parser
(content, include_rank=False, only_rank=False, **kwargs)¶ - Return type
List
[Dict
[str
,Any
]]
-
static
-
class
pykollib.request.
closet_item_add
(session, item, quantity)¶ Adds items to the player’s closet.
-
class
pykollib.request.
closet_meat_add
(session, quantity)¶ Adds meat to the player’s closet.
-
class
pykollib.request.
closet_meat_remove
(session, amount=0)¶ Takes meat from the player’s closet.
-
class
pykollib.request.
combat
(session, action, skill=None, item=None)¶ A request used for a single round of combat. The user may attack, use an item or skill, or attempt to run away.
In this constructor, action should be set to CombatRequest.ATTACK, CombatRequest.USE_ITEM, CombatRequest.USE_SKILL, CombatRequest.RUN_AWAY, or CombatRequest.PICK_POCKET. If a skill or item is to be used, the caller should also specify param to be the number of the item or skill the user wishes to use.
Submit a given option in response to a give choice
- Parameters
session (
Session
) – KoL sessionaction (
Action
) – The Action to carry out in this combat roundskill (
Optional
[Skill
{id:int
, buff:bool
}]) – If the action is Action.Skill, specifies the skill to useitem (
Union
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]},List
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}],None
]) – If the action is Action.Item, either specifies an item to use, or an array of items to funksling
-
class
pykollib.request.
craft
(session, mode, ingredients, quantity=1, max=False)¶ -
static
parser
(content, **kwargs)¶ - Return type
Response
{created:List
[ItemQuantity
{item: Item, quantity:int
}], explosion:bool
}
-
static
-
class
pykollib.request.
craft_paste
(session, item, quantity=1)¶ Creates meat paste, meat stacks, or dense meat stacks.
-
static
parser
(content, **kwargs)¶ - Return type
List
[ItemQuantity
{item: Item, quantity:int
}]
-
static
-
class
pykollib.request.
curse
(session, player, item)¶ -
static
parser
(content, **kwargs)¶ - Return type
bool
-
static
-
class
pykollib.request.
display_case_add_items
(session, items)¶ Adds items to the player’s display case.
- Parameters
session (
Session
) – Active sessionitems (
List
[ItemQuantity
{item: Item, quantity:int
}]) – List of items and their quantities to add to the case
-
class
pykollib.request.
drink
(session, item)¶ This request is for drinking booze from the inventory. It accepts the current session and the ID number of the booze to be drank. It returns the results, including and stat gain, adventure gain, effect gain, or drunkenness gain.
-
static
parser
(content, **kwargs)¶ - Return type
ResourceGain
{adventures:int
, inebriety:int
, substats:Dict
[str
,int
], stats:Dict
[str
,int
], level:int
, effects:List
[Dict
[str
,Any
]], hp:int
, mp:int
}
-
static
-
class
pykollib.request.
eat
(session, item)¶ This request is for eating food from the inventory.
- Parameters
session (
Session
) – Active sessionitem (
Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}) – Consumable to eat
-
static
parser
(content, **kwargs)¶ - Return type
ResourceGain
{adventures:int
, inebriety:int
, substats:Dict
[str
,int
], stats:Dict
[str
,int
], level:int
, effects:List
[Dict
[str
,Any
]], hp:int
, mp:int
}
-
class
pykollib.request.
equip
(session, item, slot)¶ Equips items from the inventory passed by itemId. If a slot is specified, it will attempt to equip accessories into that slot.
-
static
parser
(content, **kwargs)¶ Checks for errors due to equipping items you don’t have, or equipping items that aren’t equippable.
- Return type
bool
-
static
-
class
pykollib.request.
equipment
(session)¶ Gets info on all equipment currently equipped. Returns a lookup from the item database for each item equipped. For accessories, two possibilities are present. If equipping each slot seperately is enabled, each item’s dictionary will contain an attribute “slot” with the number of the slot it occupies. Otherwise, the “slot” attribute will have the value 0 for all equipped accessories.
-
classmethod
parser
(content, **kwargs)¶ - Return type
Outfit
{hat:Optional
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}], back:Optional
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}], shirt:Optional
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}], weapon:Optional
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}], offhand:Optional
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}], pants:Optional
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}], acc1:Optional
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}], acc2:Optional
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}], acc3:Optional
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}], familiar:Optional
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}]}
-
static
slot_to_item
(soup, link, index=0)¶ - Return type
Optional
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}]
-
classmethod
-
class
pykollib.request.
guild_malus
(session, item, quantity=1)¶ -
static
parser
(content, **kwargs)¶ - Return type
List
[ItemQuantity
{item: Item, quantity:int
}]
-
static
-
class
pykollib.request.
guild_train
(session, skill)¶ -
static
parser
(content, **kwargs)¶ - Return type
bool
-
static
- Return type
List
[ItemQuantity
{item: Item, quantity:int
}]
-
class
pykollib.request.
hermit_trade
(session, item, quantity=1)¶ -
static
parser
(content, **kwargs)¶ - Return type
List
[ItemQuantity
{item: Item, quantity:int
}]
-
static
-
class
pykollib.request.
homepage
(session, server_number=0)¶ This request is most often used before logging in. It allows the KoL servers to assign a particular server number to the user. In addition, it gives us the user’s login challenge so that we might login to the server in a more secure fashion.
-
static
parser
(content, **kwargs)¶ - Return type
Response
{server_url:str
, challenge:Optional
[str
]}
-
static
-
class
pykollib.request.
inventory
(session)¶ -
static
parser
(content, **kwargs)¶ - Return type
Dict
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]},int
]
-
returns_json
= True¶ Get a list of items in the user’s inventory.
-
static
-
class
pykollib.request.
item_description
(session, descid)¶ Gets the description of an item and then parses various information from the response.
-
static
parser
(content, **kwargs)¶
-
static
-
class
pykollib.request.
item_discard
(session, item)¶
-
class
pykollib.request.
item_information
(session, item_id)¶ Get information about a particular item.
-
static
parser
(json, **kwargs)¶ - Return type
Response
{descid:int
, name:str
, plural:Optional
[str
], image:Optional
[str
], type:Optional
[str
], autosell:int
, power:int
, num_hands:int
, can_transfer:bool
, is_cooking_ingredient:bool
, is_cocktailcrafting_ingredient:bool
, is_jewelrymaking_component:bool
, is_meatsmithing_component:bool
, is_meatpasting_component:bool
, is_fancy:bool
, is_quest_item:bool
, is_discardable:bool
, is_hardcore_denied:bool
}
-
static
-
class
pykollib.request.
item_search
(session, query, category=<Category.All: 'allitems'>, sort_items_by=<SortBy.Name: 'name'>, tiers=[<Tier.Crappy: 1>, <Tier.Decent: 2>, <Tier.Good: 3>, <Tier.Awesome: 4>, <Tier.Epic: 5>], consumable_by_me=False, weapon_attribute=3, weapon_hands=3, wearable_by_me=False, start=0)¶ Searches for an item by name using the mall justitems parameter
- Parameters
session (
Session
) – The Pykol sessionquery (
Union
[str
,Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}]) – The Item or string to search for. You can use % for a wildcard string. If you supply an Item instance, it will search for exactly and only that item.category (
Category
) – The category to search in, such as ‘food’. The default is to search in all categories. Note the convenience constants above.sort_items_by (
SortBy
) – How to sort the items listed in the output. Depending on the other search parameters, not all of the possible values will be maningful.tiers (
List
[Tier
]) – For food and booze, an array listing which quality levels to include in the search results.consumable_by_me (
bool
) – For consumable items, whether to list only items that are consumable by the session’s character.weapon_attribute (
int
) – For weapons, 1 to list only melee weapons, 2 to list only ranged weapons, or 3 to list all weapons.weapon_hands (
int
) – For weapons, 1 to list only one-handed weapons, 2 to list only 2-handed weapons, or 3 to list all weapons.wearable_by_me (
bool
) – For wearable items, whether to list only items that can be worn by the session’s character.start (
int
) – Not usually needed by the user. Tells which item in the list of results is to be returned first.
-
static
parser
(content, **kwargs)¶ - Return type
List
[Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}]
-
class
pykollib.request.
item_multi_use
(session, item, quantity)¶ Uses multiple items at once
-
static
parser
(content, **kwargs)¶ - Return type
ResourceGain
{adventures:int
, inebriety:int
, substats:Dict
[str
,int
], stats:Dict
[str
,int
], level:int
, effects:List
[Dict
[str
,Any
]], hp:int
, mp:int
}
-
static
-
class
pykollib.request.
item_use
(session, item)¶ Uses the requested item.
-
static
parser
(content, **kwargs)¶ - Return type
str
-
static
-
class
pykollib.request.
kmail_delete
(session, message_ids, box='Inbox')¶
-
class
pykollib.request.
kmail_get
(session, box='Inbox', page=0, messages_per_page=100, oldest_first=False)¶ -
static
parser
(content, **kwargs)¶ Parses through the response and constructs an array of messages.
- Return type
List
[Message
{id:int
, user_id:int
, username:str
, date:datetime
, text:str
, items:List
[ItemQuantity
{item: Item, quantity:int
}], meat:int
, type:str
}]
-
static
-
class
pykollib.request.
kmail_send
(session, recipient, message='', items=[], meat=0)¶ -
static
parser
(content, **kwargs)¶ - Return type
bool
-
static
-
class
pykollib.request.
login
(session, username, password, challenge=None, stealth=False)¶ -
static
parser
(content, **kwargs)¶ - Return type
bool
-
static
-
class
pykollib.request.
main
(session)¶
-
class
pykollib.request.
mall_purchase
(session, listing=None, store_id=None, item=None, price=None, quantity=None)¶ Purchases an item from the specified store. This will fail if the price per item is not given correctly or if the quantity is higher than the remaining quantity per day. It will purchase as many as possible if the quantity is higher than the number in the store.
-
static
parser
(content, **kwargs)¶
-
static
-
class
pykollib.request.
mall_price
(session, item)¶ Search the mall for the lowest prices of an item. This will return the 4 lowest unlimited prices, and if applicable, the 3 lowest limited prices with their limit amount per day.
I’m not sure what the counts when doing a search are, but I’m including it anyways.
- Parameters
session (
Session
) – Active sessionitem (
Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}) – Item for which to get prices
-
static
parser
(content, **kwargs)¶ - Return type
Response
{unlimited:List
[Listing
{price:int
, quantity:int
, limit:int
}], limited:List
[Listing
{price:int
, quantity:int
, limit:int
}]}
-
class
pykollib.request.
mall_search
(session, query, category=<Category.All: 'allitems'>, no_limits=False, max_price=0, num_results=0, sort_items_by=<SortBy.Name: 'name'>, sort_shops_by=<SortBy.Price: 'price'>, tiers=[<Tier.Crappy: 1>, <Tier.Decent: 2>, <Tier.Good: 3>, <Tier.Awesome: 4>, <Tier.Epic: 5>], consumable_by_me=False, weapon_attribute=3, weapon_hands=3, wearable_by_me=False, start=0)¶ Searches for an item at the mall
- Parameters
session (
Session
) – The Pykol sessionquery (
Union
[str
,Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}]) – The Item or string to search for. You can use % for a wildcard string. If you supply an Item instance, it will search for exactly and only that item.category (
Category
) – The category to search in, such as ‘food’. The default is to search in all categories. Note the convenience constants above.no_limits (
bool
) – Whether to exclude shops that have daily purchase limits.max_price (
int
) – The maximum price to show. Defaults to 0, which shows all prices.num_results (
int
) – The number of shops to show per item. The default is 0, which shows a number of shops depending on the number of items returned.sort_items_by (
SortBy
) – How to sort the items listed in the output. Depending on the other search parameters, not all of the possible values will be maningful.sort_shops_by (
SortBy
) – How to sort the shops within each individual item.tiers (
List
[Tier
]) – For food and booze, an array listing which quality levels to include in the search results.consumable_by_me (
bool
) – For consumable items, whether to list only items that are consumable by the session’s character.weapon_attribute (
int
) – For weapons, 1 to list only melee weapons, 2 to list only ranged weapons, or 3 to list all weapons.weapon_hands (
int
) – For weapons, 1 to list only one-handed weapons, 2 to list only 2-handed weapons, or 3 to list all weapons.wearable_by_me (
bool
) – For wearable items, whether to list only items that can be worn by the session’s character.start (
int
) – Not usually needed by the user. Tells which item in the list of results is to be returned first.
-
static
parser
(content, **kwargs)¶ - Return type
List
[Listing
{item: <module ‘pykollib.Item’ from ‘/media/gausie/Shared (ext4)/Projects/pykollib/pykollib/Item.py’>, price:int
, store_id:int
, store_name:str
, stock:int
, limit:int
, limit_reached:bool
}]
-
class
pykollib.request.
mall_transactions
(session)¶ Get the last 2 weeks of transactions from your store.
- Parameters
session (
Session
) – Active session
-
static
parser
(content, **kwargs)¶ - Return type
List
[Transaction
{date:datetime
, username:str
, user_id:int
, quantity:int
, item:Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}, meat:int
}]
-
class
pykollib.request.
mining
(session, mine)¶ A request used to visit a mine.
- Parameters
session (
Session
) – Active Sessionlocation_id – Id of the mine to visit
-
static
parser
(content, **kwargs)¶ - Return type
str
-
class
pykollib.request.
npc_buy
(session, store, item, quantity=1)¶ Purchases items from an NPC store.
- Parameters
session (
Session
) – Active sessionstore (
Store
{kol: pykollib.Session}) – NPC store to buy fromitem (
Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}) – Item to buyquantity (
int
) – Quantity of said item to buy
-
static
parser
(content, **kwargs)¶ - Return type
Response
{items:List
[ItemQuantity
{item: Item, quantity:int
}], meat_gained:int
}
-
class
pykollib.request.
player_profile
(session, player_id)¶ -
static
parser
(content, **kwargs)¶ - Return type
Dict
[str
,Any
]
-
static
-
class
pykollib.request.
player_search
(session, query, query_type=<QueryType.StartsWith: 1>, pvp_only=False, hardcore_only=None, level=0, fame=0)¶ -
static
parser
(content, **kwargs)¶ - Return type
List
[Result
{username:str
, user_id:int
, level:int
, character_class:str
, clan_id:Optional
[int
], clan_name:Optional
[str
], fame:Optional
[int
]}]
-
static
-
class
pykollib.request.
pulverize
(session, item, quantity=1)¶ -
static
parser
(content, **kwargs)¶ - Return type
List
[ItemQuantity
{item: Item, quantity:int
}]
-
static
-
class
pykollib.request.
questlog
(session, page=<QuestPage.Current: 1>)¶ Get info from the quest log about which quests are completed and which stage of each uncompleted quest the player is on
- Parameters
page (
QuestPage
) – Page of the quest log to request
-
static
parser
(content, **kwargs)¶ - Return type
Dict
[str
,str
]
-
class
pykollib.request.
skill_use
(session, skill, times=1, target=None)¶ -
static
parser
(content, **kwargs)¶ - Return type
str
-
static
-
class
pykollib.request.
store_inventory
(session)¶ Get a list of items currently in a user’s store
-
static
parser
(content, **kwargs)¶ Searches backoffice.php for item name, quantity, price, limit, and ID.
- Return type
List
[Listing
{item:Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}, order:int
, quantity:int
, price:int
, limit:int
, cheapest:int
}]
-
static
-
class
pykollib.request.
store_item_add
(session, item, quantity=1, limit=0, price=999999999, from_hangks=False)¶ Add a single item to your store. The interface to the mall was updated on Sept 13, 2013. It looks like items are now added only one at a time.
Notes about new URL: http://www.kingdomofloathing.com/backoffice.php itemid: this will contain an “h” in front of it if the item is in Hangk’s
There is now a submitted field name ‘_’. This appears to be the milliseconds since epoch. Testing will need to be done to see how important this is. Presumably you could just append 000 after the current seconds since epoch.
-
static
parser
(content, **kwargs)¶ - Return type
bool
-
static
-
class
pykollib.request.
store_item_remove
(session, item, quantity=1)¶ Take a single item from your store using the new Mall interface from Sep 2013
Class expects at least an itemId. If no quantity is given, a quantity of 1 is assumed
Todo: add option to remove all of an item. This will require calling StoreInventoryRequest and figuring out how many of the item there are.
- Parameters
session (
Session
) – Active sessionitem (
Item
{foldgroup_id:Optional
[int
], zapgroup_id:Optional
[int
], store_id:Optional
[int
]}) – Item to removequantity (
int
) – Amount of that item to remove
-
static
parser
(content, **kwargs)¶ - Return type
bool
-
class
pykollib.request.
store_item_update
(session, listings)¶ -
static
parser
(content, **kwargs)¶ - Return type
bool
-
static
-
class
pykollib.request.
trade_cancel
(session, id, status)¶ Cancel a trade request.
- Parameters
id (
int
) – Identifier of the trade to be cancelledstatus (
Status
) – Status of the trade to be cancelled
-
class
pykollib.request.
trade_offer_decline
(session, trade_id)¶ -
static
parser
(content, **kwargs)¶ - Return type
bool
-
static
-
class
pykollib.request.
trade_pending
(session)¶ -
static
parse_trade_items
(content)¶ - Return type
List
[ItemQuantity
{item: Item, quantity:int
}]
-
classmethod
parser
(content, **kwargs)¶ Parse each different kind of trade.
- Return type
List
[Trade
{id:int
, status:Status
, user_id:int
, username:str
, incoming_items:List
[ItemQuantity
{item: Item, quantity:int
}], outgoing_items:List
[ItemQuantity
{item: Item, quantity:int
}], incoming_meat:int
, outgoing_meat:int
, message:str
}]
-
static
-
class
pykollib.request.
trade_propose
(session, user_id, item_quantities=[], meat=0, message='')¶ -
static
parser
(content, **kwargs)¶ - Return type
bool
-
static
-
class
pykollib.request.
trade_respond
(session, trade_id, item_quantities=[], meat=0, message='')¶ -
static
parser
(content, **kwargs)¶ - Return type
bool
-
static
-
class
pykollib.request.
trade_response_accept
(session, trade_id)¶ -
static
parser
(content, **kwargs)¶ - Return type
bool
-
static
-
class
pykollib.request.
trade_response_decline
(session, trade_id)¶ -
static
parser
(content, **kwargs)¶ - Return type
bool
-
static
-
class
pykollib.request.
trophy
(session)¶ -
static
parser
(content, **kwargs)¶ - Return type
List
[Trophy
{kol: pykollib.Session}]
-
static
-
class
pykollib.request.
uneffect
(session, effect_id)¶ -
static
parser
(content, **kwargs)¶ - Return type
bool
-
static
-
class
pykollib.request.
unequip
(session, slot=None)¶ Unequips the equipment in the designated slot.
- Parameters
slot (
Optional
[Slot
]) – Will unequip item from the specified Slot, or completely undress if slot is None