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.

Travis (.org) coverage report 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/

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-3.6.1.tar.gz (97.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-3.6.1-py3-none-any.whl (109.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tibia.py-3.6.1.tar.gz
  • Upload date:
  • Size: 97.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.2

File hashes

Hashes for tibia.py-3.6.1.tar.gz
Algorithm Hash digest
SHA256 8e3016f7abf176bb020ad332b1fed1c670bfd2504c6a76c09b0eba524eb3f543
MD5 c27a50ac86e3ffae77891c9dfed9ae0a
BLAKE2b-256 ff9100f8330065314422a4b73d43d8cb2be696d95f07b9ac1c46bb8986e5d30a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tibia.py-3.6.1-py3-none-any.whl
  • Upload date:
  • Size: 109.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.2

File hashes

Hashes for tibia.py-3.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b883b817d5b435bb7c983efb1efcda235e34986fc7011aec3bd98c2f0d65392a
MD5 81020082cafc949b6fe1f2fb2237bbb1
BLAKE2b-256 aefcb4a730eccb8b21d8ac22ad4bef221c503e508407ad19dd67ed2a11f3d84a

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