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

This version

5.5.1

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.5.1.tar.gz (118.5 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.5.1-py3-none-any.whl (132.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tibia.py-5.5.1.tar.gz
  • Upload date:
  • Size: 118.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for tibia.py-5.5.1.tar.gz
Algorithm Hash digest
SHA256 9eb49d2ce11351ff6c3f4f22866a46000dc0be6e17b58fbf2d6d5bcb8e3ef871
MD5 6da7756b70e61d14e169ad40dead6321
BLAKE2b-256 58d29f634c9152109a1df893dc50a8e69376c8d93bce4dc66c4a9fc4a9da9dc3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tibia.py-5.5.1-py3-none-any.whl
  • Upload date:
  • Size: 132.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for tibia.py-5.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11fb727f6c6bcc124b4b32b9b4bcb0550f534e1ecdc2cb899416f4d47100bb81
MD5 509531da1263b84f81b54ca710a5964f
BLAKE2b-256 0e94898cc158b08dcc6309ae99fb5de269c0629bd70068a9e7ec0743b53f3fed

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