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 #3

Merged
merged 2 commits into from
Apr 9, 2021
Merged
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 @@ -124,6 +124,7 @@ Most if not all of the API is available:
client.bots.decline_challenge

client.tournaments.get
client.tournaments.get_tournament
client.tournaments.create_arena
client.tournaments.create_swiss
client.tournaments.export_arena_games
Expand Down
9 changes: 9 additions & 0 deletions berserk/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,15 @@ 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)

@deprecated(version='0.11.0', reason='use Tournaments.create_arena or Tournaments.create_swiss instead')
def create(self, clock_time, clock_increment, minutes, name=None,
Expand Down