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) GitHub (pre-)release PyPI PyPI - Python Version PyPI - License

Installing

Install and update using pip

pip install tibia.py

Usage

In order to use this library, you need to use an external library (requests, aiohttp) to fetch content from the website.

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-0.1.0a2.tar.gz (8.0 kB view hashes)

Uploaded Source

Built Distribution

tibia.py-0.1.0a2-py3-none-any.whl (9.9 kB view hashes)

Uploaded Python 3

Supported by

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