質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

API

APIはApplication Programming Interfaceの略です。APIはプログラムにリクエストされるサービスがどのように動作するかを、デベロッパーが定めたものです。

Q&A

解決済

1回答

1247閲覧

API取得時の開始時間(begin_time)と終了時間(end_time)について

grilled_python

総合スコア237

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

API

APIはApplication Programming Interfaceの略です。APIはプログラムにリクエストされるサービスがどのように動作するかを、デベロッパーが定めたものです。

0グッド

0クリップ

投稿2018/05/09 00:16

編集2018/05/09 01:13

###~~ 引数 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.

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

fuzzball

2018/05/09 00:39

聞き慣れなくてもググればすぐに見つかるでしょう。
grilled_python

2018/05/09 01:16 編集

ご指摘ありがとうございます!質問の仕方が稚拙でした。お詫びを申し上げます。エポックタイムについては既に検索してある程度理解しております。自分が理解していることが正しいのか確証がもてなかったものでご質問させていただきました。一部修正いたしましたのでご査収下さい。
guest

回答1

0

ベストアンサー

一度に大量のデータをリクエストするのを防ぐためという理解であっていますでしょうか?

任意期間のデータを取得するためだと思います。

投稿2018/05/09 01:18

fuzzball

総合スコア16731

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

grilled_python

2018/05/09 01:28 編集

なるほど、時間をずらすためではなく。例えば24時間ごとの最新データのみを更新していく。のように使うための引数ということですね。理解できました。ありがとうございます!
fuzzball

2018/05/09 01:42

「24時間ごとの最新データのみを更新していく」の意味がよく分かりませんが、昨日(0:0〜24:0)の情報を取得するとか、毎日の22:0〜24:0のデータを取得するとか、そういう感じです。
grilled_python

2018/05/09 01:47

はい!時間を指定して取得できるという事ですね。理解できました。ご丁寧にありがとうございます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問