Giter Club home page Giter Club logo

tibia.py's People

Contributors

galarzaa90 avatar tschis avatar vitorsubhi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tibia.py's Issues

New house prices fail to parse

House prices are now listed using the 'k' suffix, causing the parser to fail when trying to fetch a house from tibia.com.

DisplayItems attribute name is returning None

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?

Problem with the comma when there are more than 1000 players online.

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'

Parse character position

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".

Add support for Tournament worlds

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.

tibiapy.HousesSection.from_content is broken

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).

'Client' object has no attribute 'fetch_world_list'

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())

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.