首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >com.algorithmia.APIException: 308个意外的API响应

com.algorithmia.APIException: 308个意外的API响应
EN

Stack Overflow用户
提问于 2019-07-01 15:58:47
回答 1查看 68关注 0票数 0

我正在使用算法,一个在互联网上经过训练的ML函数的存储库。几周前,一个问题出现了,从那以后,一直无法弄清楚到底是怎么回事。我正在执行这段代码,可以在他们的官方网站上找到。

代码语言:javascript
复制
import com.algorithmia.Algorithmia;
import com.algorithmia.AlgorithmiaClient;
import com.algorithmia.algo.AlgoResponse;
import com.algorithmia.algo.Algorithm;

public class Main {

    public static void main(String[] args) throws Exception {
        String input = "A purely peer-to-peer...";
        AlgorithmiaClient client = Algorithmia.client("api_key");
        Algorithm algo = client.algo("nlp/Summarizer/0.1.8");
        algo.setTimeout(300L, java.util.concurrent.TimeUnit.SECONDS); //optional
        AlgoResponse result = algo.pipe(input);
        System.out.println(result.asJsonString());
    }

}

但是,此代码会引发以下异常:

代码语言:javascript
复制
Exception in thread "main" com.algorithmia.APIException: 308 unexpected API response: 
    at com.algorithmia.algo.Algorithm.pipeRequest(Algorithm.java:145)
    at com.algorithmia.algo.Algorithm.pipe(Algorithm.java:96)
    at Main.main(Main.java:13)

我想帮

  1. 创建一个maven项目
  2. 添加此maven依赖项
代码语言:javascript
复制
<dependency>
  <groupId>com.algorithmia</groupId>
  <artifactId>algorithmia-client</artifactId>
  <version>[,1.1.0)</version>
</dependency>
  1. 粘贴上面显示的代码

进一步观察和猜测

  • 发出cURL请求一切都按预期工作
  • 使用Python很好
  • 这可能和HttpClient有关
  • Java代码将使用像Charles这样的代理。
  • 参考公开发行 on GitHub
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-07-02 09:54:44

考虑到目前的日期,即2019年7月2日,他们发布了修复此类错误的版本1.0.16

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56838774

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档