Beispiel #1
0
 def get_videos(self, character=None):
     if character is not None:
         path = url_base + 'players/{}/videos/{}'.format(self.id, character.id)
     else:
         path = url_base + 'players/{}/videos'.format(self.id)
     response = session.get(path)
     return response.json()
Beispiel #2
0
 def get_players(region=None):
     if region is None:
         path = url_base + 'players'
     else:
         path = url_base + 'players/byregion/{}'.format(region.name)
     response = session.get(path)
     return response.json()
Beispiel #3
0
 def get_characters(game=None):
     if game is None:
         path = url_base + 'characters'
     else:
         path = url_base + 'characters/bygame/{}'.format(game.id)
     response = session.get(path)
     return response.json()
Beispiel #4
0
 def update(self):
     path = url_base + 'characters/{}'.format(self.id)
     response = session.get(path).json()
     self.name = response['Name']
     self.game_id = response['GameID']
     self.colour = response['Colour']
     self.icon_url = response['IconUrl']
     self.css_url = response['CssUrl']
     self.match_count = response['MatchCount']
     self.result_count = response['ResultCount']
     self.player_count = response['PlayerCount']
Beispiel #5
0
 def get_player(name=None, region=None, id=None):
     if id is None and name is not None and region is not None:
         path = url_base + 'players/find/{}/{}'.format(name, region.short)
     elif id is not None and name is None and region is None:
         path = url_base + 'players/{}'.format(id)
     else:
         raise IncorrectArgumentsError(
             "Player.get_player should only be executed with "
             "a name and region or a lone id"
         )
     response = session.get(path)
     return response.json()
Beispiel #6
0
 def get_character(name=None, game=None, id=None):
     if id is None and name is not None and game is not None:
         for result in Character.get_characters(game):
             if name == result['Name']:
                 return result
     elif id is not None and name is None and Game is None:
         path = url_base + 'characters/bygame/{}'.format(id)
         response = session.get(path)
         return response.json()
     else:
         raise IncorrectArgumentsError(
             "Character.get_character should only be executed with "
             "a name and game or a lone id"
         )
Beispiel #7
0
 def update(self):
     path = url_base + 'players/{}'.format(self.id)
     response = session.get(path).json()
     self.name = response['Name']
     self.region_short = response['RegionShort']
     self.region_id = response['RegionID']
     self.personal_url = response['PersonalUrl']
     self.twitch_url = response['TwitchUrl']
     self.youtube_url = response['YouTubeUrl']
     self.twitter_url = response['TwitterUrl']
     self.facebook_url = response['FacebookUrl']
     self.ssb_world_url = response['SSBWorldUrl']
     self.bio = response['Bio']
     self.tournament_count = response['TournamentCount']
     self.match_count = response['MatchCount']
     self.result_count = response['ResultCount']
     self.video_count = response['VideoCount']
Beispiel #8
0
 def get_game(id=None, short=None, name=None):
     if sum(x is not None for x in (id, short, name)) != 1:
         raise IncorrectArgumentsError(
             "Game.get_game should only be executed with "
             "one argument."
         )
     elif id is not None:
         path = url_base + 'games/{}'.format(id)
         response = session.get(path)
         return response.json()
     elif short is not None:
         for result in Game.get_games():
             if short == result['Short']:
                 return result.json()
     elif name is not None:
         for result in Game.get_games():
             if name == result['Name']:
                 return result.json()
Beispiel #9
0
 def players(self):
     path = url_base + 'characters/{}/players'.format(self.id)
     response = session.get(path)
     return response.json()
Beispiel #10
0
 def get_games():
     path = url_base + 'games'
     response = session.get(path)
     return response.json()
Beispiel #11
0
 def get_trueskill(self):
     path = url_base + 'players/{}/trueskill'.format(self.id)
     response = session.get(path)
     return response.json()
Beispiel #12
0
 def matches_lost(self):
     path = url_base + 'characters/{}/matcheslosses'.format(self.id)
     response = session.get(path)
     return response.json()
Beispiel #13
0
 def update(self):
     path = url_base + 'regions/{}'.format(self.id)
     response = session.get(path).json()
     self.name = response['Name']
     self.short = response['Short']
Beispiel #14
0
 def get_matches(self):
     path = url_base + 'players/{}/matches'.format(self.id)
     response = session.get(path)
     return response.json()
Beispiel #15
0
 def get_region(id):
     path = url_base + 'regions/{}'.format(id)
     response = session.get(path)
     return response.json()
Beispiel #16
0
 def get_regions():
     path = url_base + 'regions'
     response = session.get(path)
     return response.json()
Beispiel #17
0
 def compare_matches(self, player, game):
     path = url_base + 'compare/{}/{}/{}/matches'.format(game.id, self.id, player.id)
     response = session.get(path)
     return response.json()
Beispiel #18
0
 def get_rankings(self):
     path = url_base + 'players/{}/rankings'.format(self.id)
     response = session.get(path)
     return response.json()
Beispiel #19
0
 def get_winrates(self, game):
     path = url_base + 'players/{}/winrates/{}'.format(self.id, game.id)
     response = session.get(path)
     return response.json()