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.
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.
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
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
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-1.1.2.tar.gz
(40.6 kB
view hashes)
Built Distribution
tibia.py-1.1.2-py3-none-any.whl
(48.1 kB
view hashes)