Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/galarzaa90/tibia.py
API to parse tibia.com content into python objects.
https://github.com/galarzaa90/tibia.py
beautifulsoup crawling-python python python3 tibia webcrawling
Last synced: 7 days ago
JSON representation
API to parse tibia.com content into python objects.
- Host: GitHub
- URL: https://github.com/galarzaa90/tibia.py
- Owner: Galarzaa90
- License: apache-2.0
- Created: 2018-08-07T15:25:23.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-10-31T20:55:55.000Z (about 2 months ago)
- Last Synced: 2024-12-10T10:58:10.906Z (12 days ago)
- Topics: beautifulsoup, crawling-python, python, python3, tibia, webcrawling
- Language: Python
- Homepage: https://tibiapy.readthedocs.io/
- Size: 7.65 MB
- Stars: 38
- Watchers: 9
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.rst
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# 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.
[![PyPI](https://img.shields.io/pypi/v/tibia.py.svg)](https://pypi.python.org/pypi/tibia.py/)
![GitHub commits since latest release (branch)](https://img.shields.io/github/commits-since/Galarzaa90/tibia.py/latest/main)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/tibia.py.svg)
![PyPI - License](https://img.shields.io/pypi/l/tibia.py.svg)
![PyPI - Downloads](https://img.shields.io/pypi/dm/tibia.py)[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=Galarzaa90_tibia.py&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=Galarzaa90_tibia.py)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Galarzaa90_tibia.py&metric=coverage)](https://sonarcloud.io/summary/new_code?id=Galarzaa90_tibia.py)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=Galarzaa90_tibia.py&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=Galarzaa90_tibia.py)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=Galarzaa90_tibia.py&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=Galarzaa90_tibia.py)
[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=Galarzaa90_tibia.py&metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=Galarzaa90_tibia.py)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=Galarzaa90_tibia.py&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=Galarzaa90_tibia.py)**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```commandline
pip install tibia.py
```Installing the latest version form GitHub
```commandline
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.
```python
import tibiapy# Asynchronously
import aiohttpasync 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 requestsdef 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```
## Running from Docker
A ready to use HTTP server is also available as a Docker image, allowing you to integrate tibia.py in projects using other languages other than Python.The image can be pulled from [Docker Hub](https://hub.docker.com/r/galarzaa90/tibia.py):
```shell
docker pull galarzaa90/tibia.py
```Alternatively, the image can be built from the root of the project's source.
```shell
docker build . -t tibia.py:local
```To run the image:
```shell
docker run -p 8000:8000 --rm -ti tibia.py:local
```API documentation will be available at: http://localhost:8000/docs.
## Documentation
https://tibiapy.readthedocs.io/