<s> import os <EOL> from soccermetrics import SoccermetricsException <EOL> from soccermetrics . rest . resources import Root <EOL> from soccermetrics . rest . resources import Link <EOL> from soccermetrics . rest . resources import Validation <EOL> from soccermetrics . rest . resources import Personnel <EOL> from soccermetrics . rest . resources import MatchPlay <EOL> from soccermetrics . rest . resources import MatchAnalytics <EOL> def find_credentials ( ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> account = os . environ [ "<STR_LIT>" ] <EOL> api_key = os . environ [ "<STR_LIT>" ] <EOL> return account , api_key <EOL> except KeyError : <EOL> return None , None <EOL> class SoccermetricsRestClient ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , account = None , api_key = None , <EOL> base_uri = "<STR_LIT>" ) : <EOL> super ( SoccermetricsRestClient , self ) . __init__ ( ) <EOL> if not ( account or api_key ) : <EOL> account , api_key = find_credentials ( ) <EOL> if not ( account and api_key ) : <EOL> raise SoccermetricsException ( """<STR_LIT>""" ) <EOL> auth = { '<STR_LIT>' : account , '<STR_LIT>' : api_key } <EOL> self . root = Root ( base_uri , auth ) <EOL> self . link = Link ( base_uri , auth ) <EOL> self . validation = Validation ( base_uri , auth ) <EOL> self . players = Personnel ( "<STR_LIT>" , base_uri , auth ) <EOL> self . managers = Personnel ( "<STR_LIT>" , base_uri , auth ) <EOL> self . referees = Personnel ( "<STR_LIT>" , base_uri , auth ) <EOL> self . club = MatchPlay ( "<STR_LIT>" , base_uri , auth ) <EOL> self . natl = MatchPlay ( "<STR_LIT>" , base_uri , auth ) <EOL> self . analytics = MatchAnalytics ( base_uri , auth ) </s>
