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

Unable to fetch match history. unexpected keyword argument 'region' #208

Closed brendon1555 closed 6 years ago

brendon1555 commented 6 years ago

Get the following TypeError when fetching match history

Traceback (most recent call last):
  File "###\site-packages\discord\ext\commands\core.py", line 62, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "###\beepboop\cogs\lol.py", line 148, in kda
    history = self.cass.get_match_history(summoner=summoner, queues=queues, end_index=10)
  File "###\site-packages\cassiopeia\cassiopeia.py", line 75, in get_match_history
    return MatchHistory(summoner=summoner, begin_index=begin_index, end_index=end_index, begin_time=begin_time, end_time=end_time, queues=queues, seasons=seasons, champions=champions)
  File "###\site-packages\cassiopeia\core\common.py", line 44, in default_region_wrapper
    return method(self, *args, **kwargs)
  File "###\site-packages\cassiopeia\core\common.py", line 201, in __call__
    query = cls.__get_query_from_kwargs__(**kwargs)
  File "###\site-packages\cassiopeia\core\common.py", line 44, in default_region_wrapper
    return method(self, *args, **kwargs)
TypeError: __get_query_from_kwargs__() got an unexpected keyword argument 'region'
jjmaldonis commented 6 years ago

This should have been fixed before the most recent update of Cass. Can you update and see if you still have this issue?

tyuo9980 commented 6 years ago

This happens if the default region is set using set_default_region().

>>> import cassiopeia as cass
>>> import os
>>> cass.set_riot_api_key(os.environ["RIOT_API_KEY"])
>>> s = cass.get_summoner(name="xxcode", region='NA')
>>> ml = cass.get_match_history(summoner=s, begin_index=0, end_index=100, seasons=[cass.data.Season.from_id(11)])
Making call: https://na1.api.riotgames.com/lol/summoner/v3/summoners/by-name/xxcode
>>> cass.set_default_region("NA")
>>> ml = cass.get_match_history(summoner=s, begin_index=0, end_index=100, seasons=[cass.data.Season.from_id(11)])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/peterli/miniconda3/envs/timewinder/lib/python3.6/site-packages/cassiopeia/cassiopeia.py", line 75, in get_match_history
    return MatchHistory(summoner=summoner, begin_index=begin_index, end_index=end_index, begin_time=begin_time, end_time=end_time, queues=queues, seasons=seasons, champions=champions)
  File "/Users/peterli/miniconda3/envs/timewinder/lib/python3.6/site-packages/cassiopeia/core/common.py", line 44, in default_region_wrapper
    return method(self, *args, **kwargs)
  File "/Users/peterli/miniconda3/envs/timewinder/lib/python3.6/site-packages/cassiopeia/core/common.py", line 201, in __call__
    query = cls.__get_query_from_kwargs__(**kwargs)
  File "/Users/peterli/miniconda3/envs/timewinder/lib/python3.6/site-packages/cassiopeia/core/common.py", line 44, in default_region_wrapper
    return method(self, *args, **kwargs)
TypeError: __get_query_from_kwargs__() got an unexpected keyword argument 'region'
>>>