如何在不达到API限制的情况下使用Riot Games API进入游戏玩家ELO? [英] How can I get in game player ELO with the Riot Games API without reaching the API limit?

查看:263
本文介绍了如何在不达到API限制的情况下使用Riot Games API进入游戏玩家ELO?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对RiotGames API有疑问.我有来自Riot Games的API令牌,其每秒限制为10个请求.但是,当我想通过玩家Elo + Divisions读取游戏信息时,我需要执行另一个请求.使用游戏中的信息,我只会获得冠军符文精通,等等,但是我仍然需要elo,因此我需要对服务器执行另一个Request.

I have a question about the RiotGames API. I have an API Token from Riot Games and its limited to 10 Requests per second. However, when I want to read in game info with player Elo + Divisions, I need to do another request. With the in game info I only get champion runes masteries and so on, but I still need the elo, so I need to do another Request to the server.

当我循环所有10个播放器时,我已经达到了API限制,因为我需要对播放器列表进行常规请求,然后对每个播放器进行其他请求.

By the time I have looped all 10 players, I have reached the API limit because I need to do the general request for a player list and then other requests for each player.

推荐答案

当您收到超出限制的响应时,可以进行一些错误处理以重试该请求.

You could do some error handling to retry the request when you receive a response that says your limit has exceeded.

function request(player)
  response = riotGamesApi(player1)
  if response.status == "limit exceeded"
    response = request(player)
  else
    return response
  end
end

这将递归调用自身,直到您收到有效的响应为止

This will call itself recursively until you receive a valid response

这篇关于如何在不达到API限制的情况下使用Riot Games API进入游戏玩家ELO?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆