meraki-analytics / cassiopeia

An all-inclusive Python framework for the Riot Games League of Legends API. Cass focuses on making the data easy and fun to work with, while providing all the tools necessary to create a website or do data analysis.
MIT License
552 stars 135 forks source link

cassiopeiagg issue #156

Closed Shnatta closed 6 years ago

Shnatta commented 6 years ago

Source code

import cassiopeia as cass
from cassiopeia import Champion

annie = Champion(name="Annie", id=1, region="EUW")
print(annie.championgg.kills)

Pipeline setup

            "RiotAPI": {
                "api_key": "HIDDEN"
            },
            "ChampionGG": {
                "package": "cassiopeia_championgg",
                "api_key": "HIDDEN"
            },

Error


Making call: https://ddragon.leagueoflegends.com/realms/euw.json
Making call: http://api.champion.gg/v2/champions?api_key=None&limit=300&skip=0&elo=PLATINUM_DIAMOND_MASTER_CHALLENGER&champData=kda,damage,minions,wards,overallPerformanceScore,goldEarned&sort=winRate-desc&abriged=False
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/merakicommons/ghost.py", line 41, in wrapper
    return method(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cassiopeia_championgg/core.py", line 191, in kills
    return SearchableDictionary({Role(role): value for role, value in self._data[ChampionGGData].kills.items()})
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cassiopeia_championgg/core.py", line 75, in kills
    return self._dto["kills"]
KeyError: 'kills'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/merakicommons/ghost.py", line 87, in __get__
    return self.fget(obj)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/merakicommons/ghost.py", line 43, in wrapper
    raise GhostLoadingRequiredError(str(error))
merakicommons.ghost.GhostLoadingRequiredError: 'kills'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cassiopeia_championgg/datastores.py", line 66, in get_gg_champion_list
    return self._cached_data[(self.get_gg_champion_list, query["patch"])]
KeyError: (<bound method ChampionGG.get_gg_champion_list of <cassiopeia_championgg.datastores.ChampionGG object at 0x1043ad438>>, '7.21')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cassiopeia_championgg/datastores.py", line 82, in get_gg_champion_list
    data, response_headers = self._client.get(url, params, rate_limiters=[self._rate_limiter], connection=None, encode_parameters=False)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cassiopeia/datastores/common.py", line 133, in get
    raise HTTPError(message, status_code, response_headers)
cassiopeia.datastores.common.HTTPError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "champion_gg.py", line 49, in <module>
    pro()
  File "champion_gg.py", line 46, in pro
    print(annie.championgg.kills)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/merakicommons/ghost.py", line 90, in __get__
    obj.__load__(load_group)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cassiopeia/core/common.py", line 222, in __load__
    data = configuration.settings.pipeline.get(type=self._load_types[load_group], query=query)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/datapipelines/pipelines.py", line 433, in get
    return handler.get(query, context)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/datapipelines/pipelines.py", line 185, in get
    result = self._source.get(self._source_type, deepcopy(query), context)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/datapipelines/sources.py", line 69, in wrapper
    return call(self, query, context=context)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/datapipelines/queries.py", line 323, in wrapped
    return method(self, query, context)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cassiopeia_championgg/datastores.py", line 111, in get_item
    ggs = context[context.Keys.PIPELINE].get(ChampionGGListDto, query=items_query)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/datapipelines/pipelines.py", line 433, in get
    return handler.get(query, context)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/datapipelines/pipelines.py", line 185, in get
    result = self._source.get(self._source_type, deepcopy(query), context)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/datapipelines/sources.py", line 69, in wrapper
    return call(self, query, context=context)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/datapipelines/queries.py", line 323, in wrapped
    return method(self, query, context)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cassiopeia_championgg/datastores.py", line 85, in get_gg_champion_list
    raise HTTPError(message="Forbidden", code=error.code)
cassiopeia.datastores.common.HTTPError: Forbidden
jjmaldonis commented 6 years ago

A forbidden error usually means your API key isn't correct. Could you double check that your api.champion.gg key is correct? This is different than your Riot API key.

Shnatta commented 6 years ago

Yea i thought so, i tried to change my riot-api key to something random and got the same error so i reset my api key thru their website and set it. However the error still seem to be there. I'll wait an hour and see if it needs some time tho.

jjmaldonis commented 6 years ago

Just to make sure, you got an api key from this website right? http://api.champion.gg/

Shnatta commented 6 years ago

Yes, i get it on email from that website.

Shnatta commented 6 years ago

Does it work for you?

jjmaldonis commented 6 years ago

Yeah it does for me.

If you go to this URL (and insert your champion.gg API key in the URL), does give you info?

http://api.champion.gg/v2/champions?api_key=HIDDEN&limit=300&skip=0&elo=PLATINUM_DIAMOND_MASTER_CHALLENGER&champData=kda,damage,minions,wards,overallPerformanceScore,goldEarned&sort=winRate-desc&abriged=False

Shnatta commented 6 years ago

Yes it gives me info :/

jjmaldonis commented 6 years ago

Alright that's super weird then -- you wanna ping me on discord? In the Riot API discord server, my name is Kalturi.

Shnatta commented 6 years ago

Alright on my way!