galarzaa90 / tibia.py Goto Github PK
View Code? Open in Web Editor NEWAPI to parse tibia.com content into python objects.
Home Page: https://tibiapy.readthedocs.io/
License: Apache License 2.0
API to parse tibia.com content into python objects.
Home Page: https://tibiapy.readthedocs.io/
License: Apache License 2.0
Summer update 2019 introduced character titles, as well as a small icon that indicates which is the main character of the account in the other characters section.
House prices are now listed using the 'k' suffix, causing the parser to fail when trying to fetch a house from tibia.com.
I was querying the items of a character at the bazaar and the DisplayItem attribute name is returning None
Here is my code snippet:
response : TibiaResponse = self.client.loop.run_until_complete(self.client.fetch_auction(character_auction_id,
fetch_items=True))
details : AuctionDetails = response.data
items : List[DisplayItem] = details.items.entries
print(items)
The print of the returned list:
[<DisplayItem name=None count=22 item_id=238>, <DisplayItem name=None count=347 item_id=239>, <DisplayItem name=None count=11 item_id=266>]
Yesterday everything was working fine, the problem emerged this morning. Maybe the Tibia Bazaar website changed something in their HTML indexing?
add support for retrieving quest names in character bazaar
Hello! Cipsoft added a comma in the world list when there are more than 1000 players online.
File "\site-packages\tibiapy\world.py", line 267, in from_content
world._parse_world_info(tables.get("World Information", []))
File "\site-packages\tibiapy\world.py", line 344, in _parse_world_info
self.online_count = int(world_info.pop("players_online"))
ValueError: invalid literal for int() with base 10: '1,024'
Character's position is not being parsed, for example, Steve has CipSoft Member
position. This seems to be the only available position.
Not to be confused with the position field in Account Information.
Also, these characters show Cipsoft Member
in their status when listed as "Other Characters".
The introduction of tournament worlds broke the parsing of the world list, so this must be fixed and support for new information must be added.
War status of a guild is not being parsed at all.
rented_regex searches for The house has been rented...
but when we search a guildhall (e.g. Gladera's Mammoth Belly, the text reads The guildhall has been rented...
.
It seems the parser can not differ, and when this happens, the result is the guildhalls are always in "auctioned" state
Problem
Method tibiapy.HousesSection.from_content
(link to code) throws tibiapy.errors.InvalidContent
error instead of returning a HousesSection
object.
The reason this unintended behavior happens is because we try to access a Nonetype
object inside HouseSection._parse_filters
method when we call it house_results._parse_filters(tables["House Search"])
in line 172.
Quick fix
Commenting line 172 solves the issue for me (at least it does for my use case).
Hello,
im trying to understand how to use your parser library, with success i can make use of Client.fetch_world but not Client.fetch_world_list
+----------------------------------+--------------------------------------------+----------------------------------------------+
| Worlds_ (Individual) | :meth:World.from_content
| :meth:Client.fetch_world
|
+----------------------------------+--------------------------------------------+----------------------------------------------+
| Worlds_ (List) | :meth:WorldOverview.from_content
| :meth:Client.fetch_world_list
|
+----------------------------------+--------------------------------------------+----------------------------------------------+
import aiohttp
import tibiapy
async def fetch_world_list():
headers = {
"Cache-Control": "no-store, max-age=0"
}
async with aiohttp.ClientSession(headers=headers) as session:
try:
world_list_response = await tibiapy.Client(session=session).fetch_world_list()
if world_list_response.data:
return world_list_response.data.worlds
except tibiapy.Forbidden:
print("403 Forbidden.")
except tibiapy.NetworkError:
print("Connection error.")
return []
async def main():
worlds = await fetch_world_list()
if worlds:
for world in worlds:
print(f"World Name: {world.name}, Players Online: {world.online_count}")
if __name__ == "__main__":
asyncio.run(main())
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.