cgrok / clashroyale

Async + Sync wrapper for royaleapi.com and the CR official API
MIT License
47 stars 19 forks source link

errors accessing parts of the api #39

Closed Steph71 closed 4 years ago

Steph71 commented 4 years ago

I am using clashroyale module for a while to do some custom analysis of the data. recently I tried to run my scripts, which were working with no problem before, I dont do anything special, just:

initialize the client with my api key: client = clashroyale.RoyaleAPI(royale_api_key)

parts of the api work like expected:

client.get_clan('8LYJ0UYC')

returns:

[<Refreshable: {'tag': '8LYJ0UYC', 'name': 'Sylvanas Legion', 'description': 'Gente activa y donadora, guerras obligatorias 3/3, mínimo 100 victorias.', 'type': 'open', 'score': 58822, 'warTrophies': 9374, 'memberCount': 49, 'requiredScore': 6000, 'donations': 13470, ...]

so seems like api key is not an issue.

but trying to use:

client.get_top_players()

raises an exception:

Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev_pydevd_bundle\pydevd_exec2.py", line 3, in Exec exec(exp, global_vars, local_vars) File "", line 1, in File "C:\Users\stephan\Documents\WPy64-3760\python-3.7.6.amd64\lib\site-packages\clashroyale\royaleapi\utils.py", line 35, in wrapper return func(*new_args, new_kwargs) File "C:\Users\stephan\Documents\WPy64-3760\python-3.7.6.amd64\lib\site-packages\clashroyale\royaleapi\client.py", line 644, in get_top_players return self._get_model(url, PartialPlayerClan, params) File "C:\Users\stephan\Documents\WPy64-3760\python-3.7.6.amd64\lib\site-packages\clashroyale\royaleapi\client.py", line 219, in _get_model raise e File "C:\Users\stephan\Documents\WPy64-3760\python-3.7.6.amd64\lib\site-packages\clashroyale\royaleapi\client.py", line 212, in _get_model data, cached, ts, resp = self._request(url, **params) File "C:\Users\stephan\Documents\WPy64-3760\python-3.7.6.amd64\lib\site-packages\clashroyale\royaleapi\client.py", line 173, in _request return self._raise_for_status(resp, resp.text, method='GET') File "C:\Users\stephan\Documents\WPy64-3760\python-3.7.6.amd64\lib\site-packages\clashroyale\royaleapi\client.py", line 137, in _raise_for_status raise NotFoundError(resp, data) clashroyale.errors.NotFoundError: Not Found (404): True

Any Idea here what might cause the problem ?

I am using current master branch commit 3184c74643ef309c2acb770c7e178b6ef8ab7360

Steph71 commented 4 years ago

I figured out that I was still using the pypi version of the wrapper.

https://github.com/cgrok/clashroyale/commit/3184c74643ef309c2acb770c7e178b6ef8ab7360

works as expected