### Install tibia.py from GitHub Source: https://github.com/galarzaa90/tibia.py/blob/main/README.md Install the latest development version directly from the GitHub repository. ```command-line pip install git+https://github.com/Galarzaa90/tibia.py.git -U ``` -------------------------------- ### Install tibia.py using pip Source: https://github.com/galarzaa90/tibia.py/blob/main/README.md Use this command to install the latest stable version of the tibia.py library. ```command-line pip install tibia.py ``` -------------------------------- ### Install System Dependencies for lxml Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/intro.md On Linux systems, you may need to install libxml2-dev and libxslt-dev before installing tibia.py, especially if you encounter issues with the lxml parser. ```shell sudo apt-get install libxml2-dev libxslt-dev python-dev ``` -------------------------------- ### tibiapy.parsers.CharacterBazaarParser.from_content Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/api.md Gets the bazaar’s information and list of auctions from Tibia.com. ```APIDOC ## tibiapy.parsers.CharacterBazaarParser.from_content ### Description Get the bazaar’s information and list of auctions from Tibia.com. ### Method classmethod ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **content** (str) - The HTML content of the bazaar section at Tibia.com. ### Return type CharacterBazaar - The character bazaar with the entries found. ### Raises None ``` -------------------------------- ### Get Forums Source: https://github.com/galarzaa90/tibia.py/blob/main/tests/resources/forumBoard/forumBoard.txt Retrieves a list of Tibia forums. ```python forums = tibia_client.forums() for forum in forums: print(f"Forum Name: {forum.name}, Description: {forum.description}") ``` -------------------------------- ### Run Tibia.py Docker Container Source: https://github.com/galarzaa90/tibia.py/blob/main/README.md Start a Docker container for Tibia.py, exposing port 8000 for API access. ```shell docker run -p 8000:8000 --rm -ti tibia.py:local ``` -------------------------------- ### Get Tibia.com World Guilds URL Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/api.md Constructs a URL to the list of guilds for a specific world on Tibia.com. ```python >>> get_world_guilds_url(world="Gladera") https://www.tibia.com/community/?subtopic=guilds&world=Gladera ``` -------------------------------- ### Get Guild War Information Source: https://github.com/galarzaa90/tibia.py/blob/main/tests/resources/guild/guildAtWar.txt Retrieves detailed information about a guild's current war. This includes the opponent guild and the war's start date. ```python from tibiarequests import Guild guild = Guild("YourGuildName") print(guild.get_war_info()) ``` -------------------------------- ### Initialize Tibia API Client Source: https://github.com/galarzaa90/tibia.py/blob/main/tests/resources/forumBoard/forumBoard.txt Demonstrates how to initialize the Tibia API client. This is a prerequisite for making any requests to the API. ```python from tibia_client import TibiaClient tibia_client = TibiaClient() ``` -------------------------------- ### Initialize Tibia Client Source: https://github.com/galarzaa90/tibia.py/blob/main/tests/resources/world/worldOnline.txt Initializes the Tibia client with optional parameters for authentication and configuration. This is typically the first step before interacting with the game. ```python from tibia import Client client = Client(username="your_username", password="your_password") ``` -------------------------------- ### Build Tibia.com URL with Parameters Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/api.md Constructs a URL to Tibia.com by specifying the section, subtopic, and query parameters. Supports passing multiple parameters with the same name and using test environment URLs. ```python >>> get_tibia_url("community", "houses", page="view", houseid=55302, world="Gladera") https://www.tibia.com/community/?subtopic=houses&page=view&houseid=55302&world=Gladera ``` ```python >>> params = {'world': "Gladera"} >>> get_tibia_url("community", "worlds", **params) https://www.tibia.com/community/?subtopic=worlds&world=Gladera ``` -------------------------------- ### Client.fetch_world_overview() Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/intro.md Fetches an overview of all Tibia worlds, including their status and player counts. ```APIDOC ## Client.fetch_world_overview() ### Description Fetches an overview of all Tibia worlds, including their status and player counts. ### Method This is a client method. ### Endpoint N/A (Library method) ### Parameters None explicitly documented. ### Request Example ```python # Example usage (assuming client is an instance of tibiapy.Client) world_overview = await client.fetch_world_overview() ``` ### Response #### Success Response Returns a `WorldOverviewParser` object containing a list of all worlds and their details. ``` -------------------------------- ### get_rows Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/api.md Get all the row tags inside the container. ```APIDOC ### tibiapy.utils.get_rows(table_tag: bs4.Tag) -> bs4.Resultset[bs4.Tag] Get all the row tags inside the container. A very simple shortcut function used for better code semantics. * **Parameters:** **table_tag** (`bs4.Tag`) – The tag where row tags will be search in. Not necessarily a table tag. * **Return type:** A result set with all the found rows. ``` -------------------------------- ### Fetch Character Data with Requests and Tibia.py Parsers Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/intro.md This example demonstrates how to fetch character data from Tibia.com using the popular 'requests' library for HTTP calls and 'tibiapy.parsers.CharacterParser' for parsing the HTML content. It shows how to manually construct the URL and process the response. ```python import requests import tibiapy from tibiapy.parsers import CharacterParser # Fetching a character using requests instead of aiohttp def get_character(name): url = tibiapy.urls.get_character_url(name) r = requests.get(url) content = r.text return CharacterParser.from_content(content) ``` -------------------------------- ### tibiapy.parsers.CreaturesSectionParser.boosted_creature_from_header Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/api.md Gets the boosted creature from any Tibia.com page. ```APIDOC ## tibiapy.parsers.CreaturesSectionParser.boosted_creature_from_header ### Description Get the boosted creature from any Tibia.com page. ### Method classmethod ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **content** (str) - The HTML content of a Tibia.com page. ### Return type CreatureEntry - The boosted creature of the day. ### Raises [**InvalidContent**](#tibiapy.InvalidContent) – If content is not the HTML of a Tibia.com’s page. ``` -------------------------------- ### tibiapy.parsers.BoostableBossesParser.boosted_boss_from_header Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/api.md Gets the boosted boss from any Tibia.com page. ```APIDOC ## tibiapy.parsers.BoostableBossesParser.boosted_boss_from_header ### Description Get the boosted boss from any Tibia.com page. ### Method classmethod ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **content** (str) - The HTML content of a Tibia.com page. ### Return type BossEntry - The boosted boss of the day. ### Raises [**InvalidContent**](#tibiapy.InvalidContent) – If content is not the HTML of a Tibia.com’s page. ``` -------------------------------- ### Build Tibia.py Docker Image Locally Source: https://github.com/galarzaa90/tibia.py/blob/main/README.md Build the Tibia.py Docker image from the project's source code. ```shell docker build . -t tibia.py:local ``` -------------------------------- ### Build Tibia.com Static File URL Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/api.md Generates a URL to a static file hosted on Tibia.com by providing the file path components. ```python >>> get_static_file_url("images", "global", "content", "newsicon_community_big.gif") https://static.tibia.com/images/global/content/newsicon_community_big.gif ``` -------------------------------- ### NewsParser.from_content Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/api.md Gets a news entry by its HTML content from Tibia.com. ```APIDOC ## NewsParser.from_content ### Description Get a news entry by its HTML content from Tibia.com. ### Notes Since there’s no way to obtain the entry’s ID from the page contents, it will always be 0. A news_id can be passed to set the news_id of the resulting object. ### Method classmethod ### Parameters #### Parameters - **content** (str) - Required - The HTML content of the page. - **news_id** (int) - Optional - The news_id belonging to the content being parsed. ### Return type News | None - The news article found in the page. ### Raises - **InvalidContent** - If content is not the HTML of a news’ page. ``` -------------------------------- ### Client.fetch_forum_support_boards() Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/intro.md Fetches support board topics from the Tibia.com forums. ```APIDOC ## Client.fetch_forum_support_boards() ### Description Fetches support board topics from the Tibia.com forums. ### Method GET ### Endpoint /community/?subtopic=forum&action=boards&boardtype=support ### Response #### Success Response (200) - **topics** (list) - A list of topics from the support forums. ``` -------------------------------- ### Get Events Source: https://github.com/galarzaa90/tibia.py/blob/main/tests/resources/forumBoard/forumBoard.txt Retrieves a list of current and upcoming Tibia events. ```python events = tibia_client.events() for event in events: print(f"Event Name: {event.name}, Start Date: {event.start_date}, End Date: {event.end_date}") ``` -------------------------------- ### Client.fetch_forum_world_boards() Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/intro.md Fetches world board topics from the Tibia.com forums. ```APIDOC ## Client.fetch_forum_world_boards() ### Description Fetches world board topics from the Tibia.com forums. ### Method GET ### Endpoint /community/?subtopic=forum&action=boards&boardtype=world ### Response #### Success Response (200) - **topics** (list) - A list of topics from the world forums. ``` -------------------------------- ### NewsArchiveParser.from_content Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/api.md Gets a list of news from the HTML content of the news search page. ```APIDOC ## NewsArchiveParser.from_content ### Description Get a list of news from the HTML content of the news search page. ### Method classmethod ### Parameters #### Parameters - **content** (str) - Required - The HTML content of the page. ### Return type NewsArchive - The news archive with the news found. ### Raises - **InvalidContent** - If content is not the HTML of a news search’s page. ``` -------------------------------- ### Run Tibia.py Docker Container Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/intro.md This command starts the tibia.py Docker container, mapping port 8000 and making it available for API access. The container will be automatically removed upon exit. ```sh docker run \ -p 8000:8000 \ --rm -ti \ galarzaa90/tibia.py ``` -------------------------------- ### NewsArchiveParser.get_form_data Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/api.md Gets the form data attributes to search news with specific parameters. ```APIDOC ## NewsArchiveParser.get_form_data ### Description Get the form data attributes to search news with specific parameters. ### Method classmethod ### Parameters #### Parameters - **start_date** (date) - Required - The beginning date to search dates in. - **end_date** (date) - Required - The end date to search dates in. - **categories** (set[NewsCategory]) - Optional - The allowed categories to show. If left blank, all categories will be searched. - **types** (set[NewsType]) - Optional - The allowed news types to show. if unused, all types will be searched. ### Return type dict[str, str | int] - A dictionary with the required form data to search news in the archive. ``` -------------------------------- ### Handle Game Events Source: https://github.com/galarzaa90/tibia.py/blob/main/tests/resources/world/worldOnline.txt Sets up a listener for game events, such as player movement or item pickups. This is useful for creating bots or automated tools. ```python from tibia.event import Event @client.on(Event.PLAYER_MOVE) def on_player_move(event): print(f"Player moved to {event.position}") ``` -------------------------------- ### GuildWarsParser.from_content Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/api.md Gets a guild's war information from Tibia.com's content. ```APIDOC ## classmethod from_content(content: str) -> GuildWars ### Description Get a guild’s war information from Tibia.com’s content. ### Parameters * **content** (str) - The HTML content of a guild’s war section in Tibia.com ### Return type The guild’s war information. ``` -------------------------------- ### GuildsSectionParser.from_content Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/api.md Gets a list of guilds from the HTML content of the world guilds' page. ```APIDOC ## classmethod from_content(content: str) -> GuildsSection | None ### Description Get a list of guilds from the HTML content of the world guilds’ page. ### Parameters * **content** (str) - The HTML content of the page. ### Return type List of guilds in the current world. `None` if it’s the list of a world that doesn’t exist. ### Raises * [**InvalidContent**](#tibiapy.InvalidContent) - If content is not the HTML of a guild’s page. ``` -------------------------------- ### Client.fetch_boostable_bosses() Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/intro.md Fetches a list of boostable bosses from Tibia.com. ```APIDOC ## Client.fetch_boostable_bosses() ### Description Fetches a list of boostable bosses from Tibia.com. ### Method ```python Client.fetch_boostable_bosses() ``` ### Returns - List of boostable bosses. ``` -------------------------------- ### fetch_world_overview Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/api.md Fetches the world overview information from Tibia.com. It can also request data from the test website. ```APIDOC ## async fetch_world_overview ### Description Fetches the world overview information from Tibia.com. It can also request data from the test website. ### Method ASYNC FUNCTION ### Parameters #### Query Parameters - **test** (bool) - Optional - Whether to request the test website instead. Defaults to False. ### Response #### Success Response - **TibiaResponse[WorldOverview]** - A response containing the world overview information. ### Raises - [**Forbidden**](#tibiapy.Forbidden) – If a 403 Forbidden error was returned. This usually means that Tibia.com is rate-limiting the client because of too many requests. - [**NetworkError**](#tibiapy.NetworkError) – If there’s any connection errors during the request. ``` -------------------------------- ### FansitesSectionParser.from_content Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/api.md Gets the list of available fansites from the HTML of the Tibia.com fansites section. ```APIDOC ## classmethod from_content(content: str) -> FansitesSection ### Description Get the list of available fansites from the HTML of the Tibia.com fansites section. ### Parameters * **content** (str) - The HTML content of the page. ### Return type The fansites section. ### Raises * [**InvalidContent**](#tibiapy.InvalidContent) - If content is not the HTML of the fansites section’s page. ``` -------------------------------- ### Client.fetch_forum_community_boards() Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/intro.md Fetches community board topics from the Tibia.com forums. ```APIDOC ## Client.fetch_forum_community_boards() ### Description Fetches community board topics from the Tibia.com forums. ### Method GET ### Endpoint /community/?subtopic=forum&action=boards&boardtype=community ### Response #### Success Response (200) - **topics** (list) - A list of topics from the community forums. ``` -------------------------------- ### Get Specific Article Source: https://github.com/galarzaa90/tibia.py/blob/main/tests/resources/forumBoard/forumBoard.txt Fetches detailed content for a specific Tibia article by its title. ```python article_title = 'Tibia Wiki' article_details = tibia_client.article(article_title) print(f"Article Title: {article_details.title}") print(f"Article Content: {article_details.content}") ``` -------------------------------- ### Client.fetch_creatures() Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/intro.md Fetches a list of creatures from the Tibia.com library. ```APIDOC ## Client.fetch_creatures() ### Description Fetches a list of creatures from the Tibia.com library. ### Method GET ### Endpoint /library/?subtopic=creatures ### Parameters #### Query Parameters - **page** (int) - Optional - The page number to fetch. ### Response #### Success Response (200) - **creatures** (list) - A list of creature data. - **total_pages** (int) - The total number of pages available. ``` -------------------------------- ### Get Articles Source: https://github.com/galarzaa90/tibia.py/blob/main/tests/resources/forumBoard/forumBoard.txt Retrieves a list of Tibia articles. Allows filtering by article title. ```python articles = tibia_client.articles(title='Tibia Wiki') for article in articles: print(f"Article Title: {article.title}, URL: {article.url}") ``` -------------------------------- ### Get Specific Quest Source: https://github.com/galarzaa90/tibia.py/blob/main/tests/resources/forumBoard/forumBoard.txt Fetches detailed information for a specific Tibia quest by its name. ```python quest_name = 'The Annihilator' quest_details = tibia_client.quest(quest_name) print(f"Quest Name: {quest_details.name}") print(f"Quest Description: {quest_details.description}") ``` -------------------------------- ### Client.fetch_forum_trade_boards() Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/intro.md Fetches trade board topics from the Tibia.com forums. ```APIDOC ## Client.fetch_forum_trade_boards() ### Description Fetches trade board topics from the Tibia.com forums. ### Method GET ### Endpoint /community/?subtopic=forum&action=boards&boardtype=trade ### Response #### Success Response (200) - **topics** (list) - A list of topics from the trade forums. ``` -------------------------------- ### Fetch Character Data with Tibia.py Asynchronous Client Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/intro.md This example shows how to use the built-in asynchronous client of tibia.py to fetch character information. It handles both fetching the data and parsing it into a character object in a single step. Remember to close the client session when done. ```python import asyncio import tibiapy async def main(): client = tibiapy.Client() character = await client.fetch_character("Galarzaa Fidera") await client.session.close() if __name__ == "__main__": asyncio.get_event_loop().run_until_complete(main()) ``` -------------------------------- ### Get Quests Source: https://github.com/galarzaa90/tibia.py/blob/main/tests/resources/forumBoard/forumBoard.txt Retrieves a list of Tibia quests. Allows filtering by quest name. ```python quests = tibia_client.quests(name='The Annihilator') for quest in quests: print(f"Quest Name: {quest.name}, World: {quest.world}") ``` -------------------------------- ### Initialize Twitter Widgets Source: https://github.com/galarzaa90/tibia.py/blob/main/tests/resources/character/characterWithTitleAndBadges.txt This script initializes Twitter's follow button widget. Ensure it's loaded after the DOM is ready to avoid errors. ```javascript !function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https'; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = p + '://platform.twitter.com/widgets.js'; fjs.parentNode.insertBefore(js, fjs); } }(document, 'script', 'twitter-wjs'); ``` -------------------------------- ### Get Character by Name Source: https://github.com/galarzaa90/tibia.py/blob/main/tests/resources/forumBoard/forumBoard.txt Fetches detailed information for a specific Tibia character by its name. ```python character_name = 'Some Character' character_details = tibia_client.character(character_name) print(f"Character Name: {character_details.name}") print(f"Level: {character_details.level}") print(f"Vocation: {character_details.vocation}") ``` -------------------------------- ### tibiapy.urls.get_static_file_url Source: https://github.com/galarzaa90/tibia.py/blob/main/docs/api.md Constructs a URL to a static file hosted on Tibia.com's static domain. ```APIDOC ## tibiapy.urls.get_static_file_url(*path: str) -> str ### Description Build a URL to a static file in Tibia.com. ### Parameters #### Path Parameters - **path** (str) - Required - The path to the static file. ### Response #### Success Response - **str** - The generated URL to the static file. ### Request Example ```pycon >>> get_static_file_url("images", "global", "content", "newsicon_community_big.gif") https://static.tibia.com/images/global/content/newsicon_community_big.gif ``` ``` -------------------------------- ### Get Characters Source: https://github.com/galarzaa90/tibia.py/blob/main/tests/resources/forumBoard/forumBoard.txt Retrieves a list of Tibia characters. Allows filtering by character name. ```python characters = tibia_client.characters(name='Some Character') for character in characters: print(f"Character Name: {character.name}, World: {character.world}") ``` -------------------------------- ### Get Guild by Name Source: https://github.com/galarzaa90/tibia.py/blob/main/tests/resources/forumBoard/forumBoard.txt Fetches details for a specific Tibia guild by its name and world. ```python guild_name = 'Test Guild' world_name = 'Antica' guild_details = tibia_client.guild(guild_name, world_name) print(f"Guild Name: {guild_details.name}") print(f"Guild Crest URL: {guild_details.crest_url}") ```