pseudonym117 / Riot-Watcher

Simple Python wrapper for the Riot Games API for League of Legends
MIT License
531 stars 150 forks source link

v4/summoners/by-name/ endpoint has been removed #241

Open hingston opened 4 months ago

hingston commented 4 months ago

v4/summoners/by-name/ endpoint has been removed so lol_watcher.league.by_summoner now raises the following (running the code in the readme):

Traceback (most recent call last):
  File "C:\Python\testing\.venv\Lib\site-packages\riotwatcher\Handlers\ThrowOnErrorHandler.py", line 18, in after_request
    response.raise_for_status()
  File "C:\Python\testing\.venv\Lib\site-packages\requests\models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://na1.api.riotgames.com/lol/summoner/v4/summoners/by-name/pseudonym117

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python\testing\lol_watcher_test.py", line 7, in <module>
    me = lol_watcher.summoner.by_name(my_region, 'pseudonym117')
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python\testing\.venv\Lib\site-packages\riotwatcher\_apis\league_of_legends\SummonerApiV4.py", line 46, in by_name
    return self._request_endpoint(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python\testing\.venv\Lib\site-packages\riotwatcher\_apis\NamedEndpoint.py", line 36, in _request_endpoint
    return self._base_api.raw_request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python\testing\.venv\Lib\site-packages\riotwatcher\_apis\BaseApi.py", line 51, in raw_request
    mod = handler.after_request(
          ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python\testing\.venv\Lib\site-packages\riotwatcher\Handlers\ThrowOnErrorHandler.py", line 20, in after_request
    raise ApiError(*err.args, request=err.request, response=err.response)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://na1.api.riotgames.com/lol/summoner/v4/summoners/by-name/pseudonym117

It should be replaced with /riot/account/v1/accounts/by-riot-id/{gameName}/{tagLine} to get the puuid and then calling the summoner endpoint to maintain the same functionality as before.

pseudonym117 commented 4 months ago

Replacement already available via RiotWatcher.account.by_riot_id.

Will remove old API soon.