Introduction

Prerequisites

Tibia.py requires Python 3.6 or higher. Dependencies are installed automatically when installing the package.

However, since it uses lxml for parsing, on Linux you may require to install libxml on your system.

sudo apt-get install libxml2-dev libxslt-dev python-dev

Windows users are usually safe from this. For more information check out lxml installation page.

Installation

Tibia.py can be installed from PyPi using:

python -m pip install tibia.py

Usage

This library is composed of two parts, parsers and an asynchronous request client.

The asynchronous client (tibiapy.Client) contains methods to obtain information from Tibia.com.

The parsing methods allow you to get Python objects given the html content of a page.

The main models have a get_url method that can be used to get their Tibia.com page. With the url, the html/json content can be fetched and then passed to their from_content methods.

This allows you to use any networking module to obtain the data, and use the library to parse it.

import requests
import tibiapy

# Fetching a character using requests instead of aiohttp
def get_character(name):
    url = tibiapy.Character.get_url(name)

    r = requests.get(url)
    content = r.text
    character = tibiapy.Character.from_content(content)
    return character

Supported Sections

Section

Parsing

Fetching

Characters

Character.from_content()

Client.fetch_character()

CM Post Archive

CMPostArchive.from_content()

Client.fetch_cm_post_archive()

Event Schedule

EventSchedule.from_content()

Client.fetch_event_schedule()

Guilds (Individual)

Guild.from_content()

Client.fetch_guild()

Guilds (List)

ListedGuild.list_from_content()

Client.fetch_world_guilds()

Guilds (Wars)

GuildWars.from_content()

Client.fetch_guild_wars()

Forums (Section)

ListedBoard.list_from_content()

Client.fetch_forum_world_boards() Client.fetch_forum_trade_boards() Client.fetch_forum_community_boards() Client.fetch_forum_support_boards()

Forums (Board)

ForumBoard.from_content()

Client.fetch_forum_board()

Forums (Announcement)

ForumAnnouncement.from_content()

Client.fetch_forum_announcement()

Forums (Thread)

ForumThread.from_content()

Client.fetch_forum_thread()

Highscores

Highscores.from_content()

Client.fetch_highscores_page()

Highscores

Highscores.from_content()

Client.fetch_highscores_page()

Houses (Individual)

House.from_content()

Client.fetch_house()

Houses (List)

ListedHouse.list_from_content()

Client.fetch_world_houses()

Kill Statistics (List)

KillStatistics.from_content()

Client.fetch_kill_statistics()

News (Individual)

News.from_content()

Client.fetch_news()

News (List)

ListedNews.list_from_content()

Client.fetch_news_archive() Client.fetch_recent_news()

Tournaments

Tournament.from_content()

Client.fetch_tournament()

Tournament Leaderboards

TournamentLeaderboard.from_content()

Client.fetch_tournament_leaderboard()

Worlds (Individual)

World.from_content()

Client.fetch_world()

Worlds (List)

WorldOverview.from_content()

Client.fetch_world_list()