Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_tournament() method to get information about a tournament #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Most if not all of the API is available:
client.bots.decline_challenge

client.tournaments.get
client.tournaments.get_tournament
client.tournaments.create
client.tournaments.export_games
client.tournaments.stream_results
Expand Down
11 changes: 11 additions & 0 deletions berserk/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,17 @@ def get(self):
path = 'api/tournament'
return self._r.get(path, converter=models.Tournaments.convert_values)

def get_tournament(self, tournament_id, page=1):
"""Get information about a tournament.

:patam str tournament_id
:return: tournament information
:rtype: dict
"""
path = f'api/tournament/{tournament_id}?page={page}'
return self._r.get(path, converter=models.Tournaments.convert_values)


def create(self, clock_time, clock_increment, minutes, name=None,
wait_minutes=None, variant=None, berserkable=None, rated=None,
start_date=None, position=None, password=None, conditions=None):
Expand Down