首页 > 解决方案 > python riotwatcher 对 url 的错误请求

问题描述

我正在尝试从他的 puuid 访问玩家的匹配列表,但是当我执行我的代码时,我得到一个错误......为什么会发生这个错误?我有正确的 RiotApiKey 和正确的 player_puuid,因为当我执行来自https://developer.riotgames.com/apis#match-v5/GET_getMatchIdsByPUUID的请求时,它可以工作并返回匹配列表,我找不到为什么这个简单的任务没有工作。谢谢你的帮助

我的代码:

from riotwatcher import LolWatcher
from settings import RiotKey,riotApiRegion,player_puuid

watcher = LolWatcher(RiotKey)
matches = watcher.match.matchlist_by_puuid(riotApiRegion,player_puuid)

然后我得到这个错误:

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://euw1.api.riotgames.com/lol/match/v5/matches/by-puuid/RGAPI-a65424c1-2e67-44b0-97f5-0179453c3f5e/ids

标签: pythonriot-games-api

解决方案


新的 match_v5 使用一种新类型的区域而不是“euw1”,例如现在它是“欧洲”。

old = ["na1", "euw1", "eun1", "kr", "br1", "jp1", "ru", "oc1", "tr1", "la1", "la2"]

new = ["europe", "asia", "americas"]
from riotwatcher import LolWatcher
from settings import RiotKey,riotApiRegion,player_puuid

watcher = LolWatcher(RiotKey)
matches = watcher.match.matchlist_by_puuid("europe", player_puuid)

推荐阅读