[英]wrong rate limit in twitter
I am new to twitter API started working on it on PHP using this library . 我是twitter的新手,使用这个库开始在PHP上开发它。
// connecting to it and asking for user look up
$twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
$twitter->host = "https://api.twitter.com/1/";
$userInfo= $twitter->post( 'users/lookup', array('user_id' => "".$id)); // i am talking about this line
here I am calling users/lookup for each id I have (I know I can put multiple ids comma seprated) but I didn't know that before; 在这里我调用用户/查找我拥有的每个id(我知道我可以将多个id逗号分隔)但我以前不知道; any way I noticed I get the rate limit of 150 calls why can't I do more?
无论如何我注意到我得到150个电话的速率限制为什么我不能做更多? it should 350 calls since I am using Oauth, is this correct?
自从我使用Oauth以来它应该有350个电话,这是正确的吗?
What am I doing wrong? 我究竟做错了什么?
Lots of problems in your code. 你的代码中有很多问题。
1.0
. 1.0
。 users/lookup
is not available in 1.0
. users/lookup
在1.0
不可用 。 Its introduced in 1.1
. 1.1
引入。 Use endpoint https://api.twitter.com/1.1/
first. https://api.twitter.com/1.1/
。 user/lookup
is a GET
request not POST
. user/lookup
是一个GET
请求,而不是POST
。 see GET user/lookup . $twitter->get()
method. $twitter->get()
方法。 GET users/lookup
is 180
per 15
minute window. GET users/lookup
速率限制为每15
分钟窗口180
个 。 Thats 720
per hour. 720
。 See REST API V1.1 Limits Your final code should something like this, 你的最终代码应该是这样的,
$twitter->host = "https://api.twitter.com/1.1/";
$userInfo= $twitter->get( 'users/lookup', array('user_id' => "".$id));
@shiplu.mokadd.im users/lookup existed in v 1.0 also. @ shiplu.mokadd.im 用户/查找也存在于v 1.0中。
I'm having the same problem with v1, but it seems to be a common problem recently. 我对v1有同样的问题,但最近似乎是一个常见的问题 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.