Esempio n. 1
0
    def by_team_ids(self, ids):
        payload = {'api_key' : self._api_information.api_key}
        url = self.REGIONAL_API.format(self._api_information.region, self._version, self._api_class)
        url += ids
        result = requests.get(url, params=payload)
        if result.status_code != 200:
            raise lolapi_error.api_error(result.status_code)()
        if self._is_raw_result():
            return json.dumps(result.json())

        result = result.json()
        team_dict = dict()
        for item in result:
            team_dict[item] = lolapi_model.Team(result[item])
        return team_dict 
Esempio n. 2
0
    def by_name(self, names):
        payload = {'api_key' : self._api_information.api_key}
        url = self.REGIONAL_API.format(self._api_information.region, self._version, self._api_class)
        url += 'by-name/' + names
        result = requests.get(url, params=payload)

        if result.status_code != 200:
            raise lolapi_error.api_error(result.status_code)()
        if self._is_raw_result():
            return json.dumps(result.json())
        
        result = result.json()
        summoner_dict = list()
        for item in result:
            summoner_dict[item] = lolapi_model.Summoner(result[item])
        return summoner_dict
Esempio n. 3
0
    def masteries(self, ids):
        payload = {'api_key' : self._api_information.api_key}
        url = self.REGIONAL_API.format(self._api_information.region, self._version, self._api_class)
        url += ids + '/masteries'

        result = requests.get(url, params=payload)
        if result.status_code != 200:
            raise lolapi_error.api_error(result.status_code)()
        if self._is_raw_result():
            return json.dumps(result.json())

        result = result.json()
        summoner_dict = dict()
        for item in result:
            summoner_dict[item] = lolapi_model.MasteryPages(result[item])
        return summoner_dict