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, 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.urls.get_character_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.urls.get_character_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-6.3.0.tar.gz
(118.2 kB
view details)
Built Distribution
tibia.py-6.3.0-py3-none-any.whl
(114.9 kB
view details)
File details
Details for the file tibia.py-6.3.0.tar.gz
.
File metadata
- Download URL: tibia.py-6.3.0.tar.gz
- Upload date:
- Size: 118.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3b8d9b76b4f4645db1f17356fac923019facf5ce1d4c97ad0a6cf7f726531af |
|
MD5 | 67241467dec9b70f14c69940b01db640 |
|
BLAKE2b-256 | 80e036e9783d556f35d1324d498a237010a16fa8791afe0c8fc8b2c60bdc0ac7 |
File details
Details for the file tibia.py-6.3.0-py3-none-any.whl
.
File metadata
- Download URL: tibia.py-6.3.0-py3-none-any.whl
- Upload date:
- Size: 114.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4f2c4e6d8bec17aff26db407a5888b8938bb85a5b467844b93a067da100e350 |
|
MD5 | 9cd1dd4bb38a76023f757010c4338329 |
|
BLAKE2b-256 | 2dca120b17a8d9635568e1fdc56e64178d2b07ba9101476f13314c9754a4f702 |