def League(self, leagueid=None): leaguelist = [] if leagueid: url = "%s/%s/lookupleague.php?id=%s" % (API_BASE_URL, API_KEY, str(leagueid)) data = json.load(urllib2.urlopen(url)) leagues = data["leagues"] if leagues: for lg in leagues: leaguelist.append(_league.as_league(lg)) else: xbmc.log(msg="[TheSportsDB] leagueid must be provided", level=xbmc.LOGERROR) return leaguelist
def League(self, leagueid=None): leaguelist = [] if leagueid: url = '%s/%s/lookupleague.php?id=%s' % (API_BASE_URL, API_KEY, str(leagueid)) data = json.load(urllib2.urlopen(url)) leagues = data["leagues"] if leagues: for lg in leagues: leaguelist.append(_league.as_league(lg)) else: xbmc.log(msg="[TheSportsDB] leagueid must be provided", level=xbmc.LOGERROR) return leaguelist
def Leagues(self, country=None, sport=None): leaguelist = [] if country or sport: if country and not sport: url = "%s/%s/search_all_leagues.php?c=%s" % (API_BASE_URL, API_KEY, urllib.quote(country)) elif not country and sport: url = "%s/%s/search_all_leagues.php?s=%s" % (API_BASE_URL, API_KEY, urllib.quote(sport)) else: url = "%s/%s/search_all_leagues.php?s=%s&c=%s" % ( API_BASE_URL, API_KEY, urllib.quote(sport), urllib.quote(country), ) data = json.load(urllib2.urlopen(url)) leagues = data["countrys"] if leagues: for lg in leagues: leaguelist.append(_league.as_league(lg)) else: xbmc.log(msg="[TheSportsDB] country or league must be provided", level=xbmc.LOGERROR) return leaguelist
def Leagues(self, country=None, sport=None): leaguelist = [] if country or sport: if country and not sport: url = '%s/%s/search_all_leagues.php?c=%s' % ( API_BASE_URL, API_KEY, urllib.quote(country)) elif not country and sport: url = '%s/%s/search_all_leagues.php?s=%s' % ( API_BASE_URL, API_KEY, urllib.quote(sport)) else: url = '%s/%s/search_all_leagues.php?s=%s&c=%s' % ( API_BASE_URL, API_KEY, urllib.quote(sport), urllib.quote(country)) data = json.load(urllib2.urlopen(url)) leagues = data["countrys"] if leagues: for lg in leagues: leaguelist.append(_league.as_league(lg)) else: xbmc.log( msg="[TheSportsDB] country or league must be provided", level=xbmc.LOGERROR) return leaguelist