Skip to content

Commit c966b69

Browse files
committed
Global highscores properly parsed with world = None
1 parent b32d1d5 commit c966b69

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ Changelog
66
Due to this library relying on external content, older versions are not guaranteed to work.
77
Try to always use the latest version.
88

9+
.. v3.0.1:
10+
11+
3.0.1 (2020-07-134)
12+
==================
13+
14+
- ``Highscores.world`` is now ``None`` when the highscores are for all worlds.
15+
916
.. v3.0.0:
1017
1118
3.0.0 (2020-07-13)

tibiapy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from tibiapy.world import *
1717
from tibiapy.client import *
1818

19-
__version__ = '3.0.0'
19+
__version__ = '3.0.1'
2020

2121
from logging import NullHandler
2222

tibiapy/highscores.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Highscores(abc.Serializable):
2727
Attributes
2828
----------
2929
world: :class:`str`
30-
The world the highscores belong to.
30+
The world the highscores belong to. If this is ```None``, the highscores shown are for all worlds.
3131
category: :class:`Category`
3232
The selected category to displays the highscores of.
3333
vocation: :class:`VocationFilter`
@@ -117,7 +117,7 @@ def from_content(cls, content):
117117
raise InvalidContent("content does is not from the highscores section of Tibia.com")
118118
world_filter, vocation_filter, category_filter = filters
119119
world = world_filter.find("option", {"selected": True})["value"]
120-
if world == "ALL WORLDS":
120+
if world == "ALL":
121121
world = None
122122
category = int(category_filter.find("option", {"selected": True})["value"])
123123
vocation_selected = vocation_filter.find("option", {"selected": True})
@@ -147,7 +147,7 @@ def from_content(cls, content):
147147
return highscores
148148

149149
@classmethod
150-
def get_url(cls, world, category=Category.EXPERIENCE, vocation=VocationFilter.ALL, page=1):
150+
def get_url(cls, world=None, category=Category.EXPERIENCE, vocation=VocationFilter.ALL, page=1):
151151
"""Gets the Tibia.com URL of the highscores for the given parameters.
152152
153153
Parameters
@@ -165,6 +165,8 @@ def get_url(cls, world, category=Category.EXPERIENCE, vocation=VocationFilter.AL
165165
-------
166166
The URL to the Tibia.com highscores.
167167
"""
168+
if world is None:
169+
world = "ALL"
168170
return get_tibia_url("community", "highscores", world=world, category=category.value, profession=vocation.value,
169171
currentpage=page)
170172

0 commit comments

Comments
 (0)