###~~ 引数 begin_timeとend_timeの使い方がよくわからない~~
###引数 begin_timeとend_timeとは習得時間をずらすことによって一度に大量のデータをリクエストするのを防ぐためという理解であっていますでしょうか?
riotというゲーム会社のAPIを利用してアプリを制作しています。
LOLという対戦ゲームのプレイヤーのマッチ(戦闘)情報を取得したいのですが、サーバーに負荷をかけないためだと思うのですが複数の引数が存在します
引数に何も指定しない場合、100件のみ取得します。一度の呼び出しで取得できる上限は100件のようです。
python3.6
第一引数は調べたいプレイヤーのリージョン、第二引数はプレイヤーIDです。
フィルターのための引数の指定はしていないため、最初の100件のみ返ってきます。
python
1def get_matchlist(): 2 '''マッチリスト取得''' 3 all_matchlist = watcher.match.matchlist_by_account(your_region,player_detail['accountId']) 4 return all_matchlist 5#実行結果は最初の100件のみ
引数 begin_index、end_indexに101~201と指定すると次の200件が取得できます。
def get_matchlist(): '''マッチリスト取得''' all_matchlist = watcher.match.matchlist_by_account(your_region,player_detail['accountId'],begin_index=101, end_index=201) return all_matchlist #次の100件分が取得できる。
習得時間をずらすことによって一度に大量のデータをリクエストするのを防ぐためが私の理解です。色々な数字を入力して試したいのですが、変な数字を入力するとAPIKEYがブラックリストに載り、24時間使えなくなってしまうので中々出来ないでおります。
エポックミリ秒という聞き慣れない単位もあり質問させていただきました。
どうぞよろしくおねがいいたします
def get_matchlist(): '''マッチリスト取得''' all_matchlist = watcher.match.matchlist_by_account(your_region,player_detail['accountId'],begin_index=101, end_index=201,begin_time=0, end_time=0) return all_matchlist
公式ドキュメント
・matchlist_by_account()について
IMPLEMENTATION NOTES
A number of optional parameters are provided for filtering. It is up to the caller to ensure that the combination of filter parameters provided is valid for the requested account, otherwise, no matches may be returned. If beginIndex is specified, but not endIndex, then endIndex defaults to beginIndex+100. If endIndex is specified, but not beginIndex, then beginIndex defaults to 0. If both are specified, then endIndex must be greater than beginIndex. The maximum range allowed is 100, otherwise a 400 error code is returned. If beginTime is specified, but not endTime, then these parameters are ignored. If endTime is specified, but not beginTime, then beginTime defaults to the start of the account's match history. If both are specified, then endTime should be greater than beginTime. The maximum time range allowed is one week, otherwise a 400 error code is returned.
・begin timeについて
The begin time to use for filtering matchlist specified as epoch milliseconds. If beginTime is specified, but not endTime, then these parameters are ignored. If endTime is specified, but not beginTime, then beginTime defaults to the start of the account's match history. If both are specified, then endTime should be greater than beginTime. The maximum time range allowed is one week, otherwise a 400 error code is returned.
・end timeについて
The end time to use for filtering matchlist specified as epoch milliseconds. If beginTime is specified, but not endTime, then these parameters are ignored. If endTime is specified, but not beginTime, then beginTime defaults to the start of the account's match history. If both are specified, then endTime should be greater than beginTime. The maximum time range allowed is one week, otherwise a 400 error code is returned.
回答1件
あなたの回答
tips
プレビュー