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
553 stars 134 forks source link

Unable to see participants in a match #265

Closed abhargv3 closed 5 years ago

abhargv3 commented 5 years ago

Not sure if this is an issue with cass or my workflow, but basically I tried getting the participants without initializing cass with an API key and it gave me a 403, but after reinitializing with an API key, the participant key remained empty. Here is the workflow for more details:

>>> from cassiopeia import Match
>>> m = Match(id=2912307370, region="NA")
>>> m
<cassiopeia.core.match.Match object at 0x000001F6FE5538D0>
>>> m
<cassiopeia.core.match.Match object at 0x000001F6FE5538D0>
>>> m.participants
[]
>>> import cassiopeia as cass
>>> cass.get_match(id=2912307370, region="NA")
<cassiopeia.core.match.Match object at 0x000001F6FE5538D0>
>>> m = cass.get_match(id=2912307370, region="NA")
>>> m.participants
[]
>>> m.creation
Making call: https://na1.api.riotgames.com/lol/match/v3/matches/2912307370
Traceback (most recent call last):
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\merakicommons\cache.py", line 15, in wrapper
    return getattr(self, s)
AttributeError: 'Match' object has no attribute '_lazy__creation'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\merakicommons\ghost.py", line 41, in wrapper
    return method(*args, **kwargs)
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\merakicommons\cache.py", line 17, in wrapper
    value = method(self)
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\cassiopeia\core\match.py", line 1439, in creation
    return self._data[MatchData].creation
AttributeError: 'MatchData' object has no attribute 'creation'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\merakicommons\ghost.py", line 87, in __get__
    return self.fget(obj)
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\merakicommons\ghost.py", line 43, in wrapper
    raise GhostLoadingRequiredError(str(error))
merakicommons.ghost.GhostLoadingRequiredError: 'MatchData' object has no attribute 'creation'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\cassiopeia\datastores\riotapi\common.py", line 226, in _get
    return request()
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\cassiopeia\datastores\riotapi\common.py", line 277, in __call__
    return self._retry_request_by_handling_error(error)
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\cassiopeia\datastores\riotapi\common.py", line 308, in _retry_request_by_handling_error
    raise error
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\cassiopeia\datastores\riotapi\common.py", line 271, in __call__
    connection=self.connection)
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\cassiopeia\datastores\common.py", line 142, in get
    raise HTTPError(message, status_code, response_headers)
cassiopeia.datastores.common.HTTPError: Forbidden

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\merakicommons\ghost.py", line 90, in __get__
    obj.__load__(load_group)
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\cassiopeia\core\common.py", line 281, in __load__
    data = configuration.settings.pipeline.get(type=self._load_types[load_group], query=query)
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\datapipelines\pipelines.py", line 459, in get
    return handler.get(query, context)
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\datapipelines\pipelines.py", line 185, in get
    result = self._source.get(self._source_type, deepcopy(query), context)
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\datapipelines\sources.py", line 120, in get
    return source.get(type, deepcopy(query), context)
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\datapipelines\sources.py", line 69, in wrapper
    return call(self, query, context=context)
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\datapipelines\queries.py", line 323, in wrapped
    return method(self, query, context)
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\cassiopeia\datastores\riotapi\match.py", line 40, in get_match
    data = self._get(url, {}, app_limiter=app_limiter, method_limiter=method_limiter)
  File "C:\Users\abhar\AppData\Local\Programs\Python\Python36\lib\site-packages\cassiopeia\datastores\riotapi\common.py", line 243, in _get
    raise new_error from error
cassiopeia.datastores.riotapi.common.APIRequestError: The Riot API returned an error on the request. The received error was 403: "Forbidden"
>>> cass.set_riot_api_key("Some api key")
>>> m.creation
Making call: https://na1.api.riotgames.com/lol/match/v3/matches/2912307370
<Arrow [2018-11-18T06:55:32.349000+00:00]>
>>> m.participatns
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Match' object has no attribute 'participatns'
>>> m.participants
[]
jjmaldonis commented 5 years ago

Thanks for posting this! I'm going to reopen it so we don't forget to look into it.

abhargv3 commented 5 years ago

Hey I closed it because I realized it was a mistake on my part (late night I guess). I did not initialize the match after setting my api key.

zacholade commented 5 years ago

Also be careful with your spelling of "participants". AttributeError: 'Match' object has no attribute 'participatns'

Glad you resolved your problem here though.

jjmaldonis commented 5 years ago

I'm pretty sure I didn't need to reopen this, and a quick test looks like things are okay so I'm going to close this.