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-4.1.3.tar.gz (103.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-4.1.3-py3-none-any.whl (115.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tibia.py-4.1.3.tar.gz
  • Upload date:
  • Size: 103.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for tibia.py-4.1.3.tar.gz
Algorithm Hash digest
SHA256 ce4affce588810e457774f3c0feefad3615bbeb16a07cb2ad9d77d7f69d596f7
MD5 1adb6fd0d21d9d156f67cce81caa51c5
BLAKE2b-256 722a3d86e8776da0290fe9a7ac7ecb5df83f1eecfd03f5e9b8c9aab20a7b927e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tibia.py-4.1.3-py3-none-any.whl
  • Upload date:
  • Size: 115.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for tibia.py-4.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 531d0f6cda90219552e01638123aa88d91d7ebf0e570e53af287150b3febfe2f
MD5 f8e8c663166d51ee34c33a19ea906b18
BLAKE2b-256 463fb214e73aa5d1cc41ee300fc464919e290b1e61ce6ce7ab64ba39b81cef4b

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