Skip to main content

API that parses website content into python data.

Project description

Tibia.py

An API to parse Tibia.com content into object oriented data.

No fetching is done by this module, you must provide the html content.

GitHub Workflow Status codecov PyPI PyPI - Python Version PyPI - License

Features:

  • Converts data into well-structured Python objects.
  • Type consistent attributes.
  • All objects can be converted to JSON strings.
  • Can be used with any networking library.
  • Support for characters, guilds, houses and worlds, tournaments, forums, etc.

Installing

Install and update using pip

pip install tibia.py

Installing the latest version form GitHub

pip install git+https://github.com/Galarzaa90/tibia.py.git -U

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.

import tibiapy

# Asynchronously
import aiohttp

async def get_character(name):
    url = tibiapy.Character.get_url(name)

    async with aiohttp.ClientSession() as session:
        async with session.get(url) as resp:
            content = await resp.text()
    character = tibiapy.Character.from_content(content)
    return character

# Synchronously
import requests

def get_character_sync(name):
    url = tibiapy.Character.get_url(name)
    
    r = requests.get(url)
    content = r.text
    character = tibiapy.Character.from_content(content)
    return character

Documentation

https://tibiapy.readthedocs.io/

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tibia.py-5.7.1.tar.gz (120.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tibia.py-5.7.1-py3-none-any.whl (133.2 kB view details)

Uploaded Python 3

File details

Details for the file tibia.py-5.7.1.tar.gz.

File metadata

  • Download URL: tibia.py-5.7.1.tar.gz
  • Upload date:
  • Size: 120.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for tibia.py-5.7.1.tar.gz
Algorithm Hash digest
SHA256 e700c07d5b8511106780d58c283514adb9aeaecb76677fc6b6e146259a45eede
MD5 19a0d30fd68b4fea67094673296bccce
BLAKE2b-256 ec4818c077819baf4526062965a6cb2c050ba2f30d895816f7d6297866139cdd

See more details on using hashes here.

File details

Details for the file tibia.py-5.7.1-py3-none-any.whl.

File metadata

  • Download URL: tibia.py-5.7.1-py3-none-any.whl
  • Upload date:
  • Size: 133.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for tibia.py-5.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 17d6caf4048ecbca0c034c0f08871650bd2d4911e333ca16ccf4eb43e0b61f8f
MD5 dcf9a2dd2562047291a68aafd99fb5b3
BLAKE2b-256 833885c0888d3de04c8caf5db8d6b1b37e030aeb41365cf5345b80425e18b8e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page