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.
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)
try:
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-0.1.0a1.tar.gz
(7.9 kB
view hashes)
Built Distribution
Close
Hashes for tibia.py-0.1.0a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29cbe68c879026f37ed6218dd0013d633ec82f9316d8c014bbee43b47caff2eb |
|
MD5 | 5b5ebd4a3996e8032c452cb5efa435b3 |
|
BLAKE2b-256 | 723712681e7d729bfcce2d7f077681e248e18f38fef1bf03213962f8a1613750 |