mirror of
https://github.com/Steffo99/steamleaderboards.git
synced 2024-11-21 23:34:17 +00:00
Fix critical bug. Oops!
This commit is contained in:
parent
9097e2ea37
commit
283441b63c
2 changed files with 3 additions and 2 deletions
2
setup.py
2
setup.py
|
@ -5,7 +5,7 @@ with open("README.md", "r") as f:
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="steamleaderboards",
|
name="steamleaderboards",
|
||||||
version="0.0.1",
|
version="0.0.2",
|
||||||
author="Stefano Pigozzi",
|
author="Stefano Pigozzi",
|
||||||
author_email="ste.pigozzi@gmail.com",
|
author_email="ste.pigozzi@gmail.com",
|
||||||
description="A wrapper for the Steam Leaderboards",
|
description="A wrapper for the Steam Leaderboards",
|
||||||
|
|
|
@ -8,13 +8,14 @@ class LeaderboardGroup:
|
||||||
xml = requests.get(f"https://steamcommunity.com/stats/{app_id}/leaderboards/?xml=1")
|
xml = requests.get(f"https://steamcommunity.com/stats/{app_id}/leaderboards/?xml=1")
|
||||||
_bs = BeautifulSoup(xml.content, features="lxml")
|
_bs = BeautifulSoup(xml.content, features="lxml")
|
||||||
self.leaderboards = []
|
self.leaderboards = []
|
||||||
|
self.app_id = app_id
|
||||||
for leaderboard in _bs.find_all("leaderboard"):
|
for leaderboard in _bs.find_all("leaderboard"):
|
||||||
self.leaderboards.append(ProtoLeaderboard(leaderboard, app_id))
|
self.leaderboards.append(ProtoLeaderboard(leaderboard, app_id))
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<LeaderboardGroup for {self.app_id} with {len(self.leaderboards)} leaderboards>"
|
return f"<LeaderboardGroup for {self.app_id} with {len(self.leaderboards)} leaderboards>"
|
||||||
|
|
||||||
def get(self, name=None, *, display_name=None) -> typing.Optional["Leaderboard"]:
|
def get(self, name=None, *, lbid=None, display_name=None) -> typing.Optional["Leaderboard"]:
|
||||||
"""Get the full leaderboard with the specified parameter."""
|
"""Get the full leaderboard with the specified parameter."""
|
||||||
if bool(lbid) + bool(name) + bool(display_name) > 1:
|
if bool(lbid) + bool(name) + bool(display_name) > 1:
|
||||||
raise ValueError("You can only find a leaderboard by 1 parameter.")
|
raise ValueError("You can only find a leaderboard by 1 parameter.")
|
||||||
|
|
Loading…
Reference in a new issue