首页 > 解决方案 > 是什么导致 Klout API 出现 403 错误?

问题描述

我有一个 Klout 的 API 密钥,我编写了一个每天执行 6 次调用的服务,以跟踪 6 个社交媒体帐户的性能。该服务上周突然停止工作。

这是我帐户上的日志的概述:

在此处输入图像描述

我混淆了我的密钥,但如您所见,我的 Starter Plan 的状态是活动的;但是:错误显示403 inactive Plan (Proxy)

java.io.IOException: Server returned HTTP response code: 403 for URL: http://api.klout.com/v2/identity.json/twitter?screenName=redacted&key=redacted
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
    at com.directmediatips.klout.KloutRequests.sendRequest(KloutRequests.java:66)
    at com.directmediatips.klout.Klout.getUserIdFromTwitterScreenName(Klout.java:119)
    at com.directmediatips.klout.Klout.main(Klout.java:126)

在它说的地方redacted,有一个 Twitter 句柄和一个 API 密钥。

构造函数和相关方法是:

private String apiKey;

public Klout(String apiKey) {
    this.apiKey = apiKey;
}

public UserId getUserIdFromTwitterScreenName(String screenName) throws IOException {
    return new UserId(new JSONObject(KloutRequests.sendRequest(String.format(
            KloutRequests.ID_FROM_TWITTER_SCREENNAME, screenName, apiKey))));
}

public static String sendRequest(String request) throws IOException {
    URL url = new URL(request);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    connection.setRequestMethod("GET");
    connection.setUseCaches(false);
    BufferedReader in = new BufferedReader(
            new InputStreamReader(connection.getInputStream()));
    String line;
    StringBuilder response = new StringBuilder();
    while ((line = in.readLine()) != null) {
        response.append(line);
    }
    in.close();
    return response.toString();
}

我唯一能想到的是,Klout 停用了我的帐户,但是当我登录 Klout 时,这并没有反映在我的帐户面板中,但也许我在我的代码中忽略了一些非常简单的东西。指标还显示,我每天拨打的电话从未超过 6 次,这远低于关键速率限制。

标签: javaapiklout

解决方案


我收到了对我的推文的答复:

在此处输入图像描述

推文指的是这个博客项目

我写信通知您 Lithium 已决定停止 Klout 服务,自 2018 年 5 月 25 日起生效。

简而言之:我使用的服务不再可用,因为 Klout 将停止使用。


推荐阅读