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.urls.get_character_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.urls.get_character_url(name)
    
    r = requests.get(url)
    content = r.text
    character = tibiapy.Character.from_content(content)
    return character

Documentation

https://tibiapy.readthedocs.io/

Project details


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-6.0.0.tar.gz (56.4 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-6.0.0-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tibia.py-6.0.0.tar.gz
Algorithm Hash digest
SHA256 68253cac6ede04e7d3a725a8dfdef51cd17d734eb26fc3cbadf0d3287e3f4dd7
MD5 632e9be9de26c319b4e19df85b37f589
BLAKE2b-256 fb30f00473ed47907b866fdfcaeb1643667374693e9f26f4e8f99f2dd581772e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tibia.py-6.0.0-py3-none-any.whl
  • Upload date:
  • Size: 31.0 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-6.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c1b905d6776ffef8b8aa38d0856d23a53edf94bcbd217d7025a87cb8cd69864
MD5 af14987c84049db7a1e4ef0097b8036e
BLAKE2b-256 b7646e6498056deba0316bfefd54337f5d84ada0aa72ddc2654b1a093a1242dd

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