为什么R httr :: POST为JPred 4 webserver返回415?

时间:2018-06-18 15:39:32

标签: post http-post httr

我正在为Jpred http://www.compbio.dundee.ac.uk/jpred/api.shtml编写一个R包装器。我无法弄清楚为什么我的代码无法正常工作。我仔细检查其他网站,它的工作原理。

用python编写的代码是可行的,但在带有httr包的R中却没有。

python代码是:

With ThisWorkbook
    set NewSheet = .Sheets.Add(After:=.Sheets(.Sheets.Count)) 
    NewSheet.Name = worksheetname
End With

然后返回import requests query = "skipPDB=TRUE£€£€format=seq£€£€email=TRUE£€£€name=seq£€£€>query\nMATPHDE" print(query.encode("utf-8")) HOST = "http://www.compbio.dundee.ac.uk/jpred4/cgi-bin/rest" result = requests.post("{}/{}".format(HOST, "job"), data=query.encode("utf-8"), headers={"Content-type": "text/txt"})

我的R代码是:

<Response [202]>

它返回状态415,这是服务器错误。

query <- "skipPDB=TRUE\xc2\xa3\xe2\x82\xac\xc2\xa3\xe2\x82\xacformat=seq\xc2\xa3\xe2\x82\xac\xc2\xa3\xe2\x82\xacemail=TRUE\xc2\xa3\xe2\x82\xac\xc2\xa3\xe2\x82\xacname=seq\xc2\xa3\xe2\x82\xac\xc2\xa3\xe2\x82\xac>query\nMATPHDE"

response <- httr::POST(url=paste(host, "job", sep="/"), body = query)

有人能告诉我为什么它在R中不起作用吗?

非常感谢和非常尊重。

0 个答案:

没有答案