【发布时间】:2015-05-06 17:51:14
【问题描述】:
我有一个用于获取我的推文的 java 程序,下面是代码
public class TwitterTest {
public static void main(String[] args) {
Twitter twitter = new TwitterFactory().getInstance();
// My Applications Consumer and Auth Access Token
//twitter.setOAuthConsumer("67MIcbC1X6mbpaEqxa7YTd1hDPIdLb5bLKf4TxIRLAsX63DgFQ", "7HHjSHJ6Rjxx4ASC2465AlWBG");
twitter.setOAuthAccessToken(new AccessToken("s1y1iAhG5nsXTrE9OVAsqMtqiLIP4QKT8CmTRVgV9LC3O", "110445397-Cf3l9NAK4iD8VAERXp0ZMKnAfWx9KywuJs3OSdkF"));
try {
ResponseList<Status> a = twitter.getUserTimeline(new Paging(1,5));
for(Status b: a) {
System.out.println(b.getText());
}
}catch(Exception e ){
}
}
}
下面是我得到的错误
Relevant discussions can be found on the Internet at:
http://www.google.co.jp/search?q=b64d2231 or
http://www.google.co.jp/search?q=309f0452
TwitterException{exceptionCode=[b64d2231-309f0452], statusCode=403, message=SSL is required, code=92, retryAfter=-1, rateLimitStatus=RateLimitStatusJSONImpl{remaining=178, limit=180, resetTimeInSeconds=1430935706, secondsUntilReset=775}, version=3.0.3}
错误的原因是什么?
【问题讨论】:
-
你怎么知道你没有任何错误?您正在默默地处理所有异常。你至少应该在你的 catch 块中调用
e.printStackTrace()以确保你对 twitter 的调用没有失败。 -
@azurefrog Ya :( 这是我得到的错误 相关讨论可以在 Internet 上找到:google.co.jp/search?q=b64d2231 或 google.co.jp/search?q=309f0452 TwitterException{exceptionCode=[b64d2231-309f0452], statusCode=403, message=SSL 是必需的,code=92, retryAfter=-1, rateLimitStatus=RateLimitStatusJSONImpl{remaining=178, limit=180, resetTimeInSeconds=1430935706, secondsUntilReset=775}, version=3.0.3}。会更新我的问题
-
@azurefrog 谢谢老兄!!你能看看这个错误吗?
-
@azurefrog 它声明需要 ssl。是这个原因吗?
-
是的。至少例外是这么说的。