English 中文(简体)
RCurl: HTTP Authentication when Site Responses with HTTP 401 Code Without WWW-Authenticate
原标题:RCurl: HTTP Authentication When Site Responds With HTTP 401 Code Without WWW-Authenticate
  • 时间:2012-04-14 22:45:14
  •  标签:
  • r
  • rcurl

http://docs.picloud.com/rest.html。 http://www.omegahat.org/RCurl/RCurlJSS.pdf a. 向APIC服务器提出请求的一揽子方案。 该软件使用“吉大港”基本认证,以核实用户有足够的许可。 皮卢克文件举例说明了如何使用pi和用曲线认证:

 $ curl -u  key:secret_key  https://api.picloud.com/job/?jids=12

这完全可行。 将这段话传给相等的RCurl指挥:

getURL("https://api.picloud.com/job/?jids=12", userpwd="key:secret") 

执行这一职能 我收到以下错误信息:

[1] "{"error": {"msg": "No HTTP Authorization information present", "code": 995, "retry": false}}"

我更深入地探讨这一问题,发现曲线指挥所提出的吉大港警察局的请求包括第一个GET指挥部的授权区。

Rurl没有这样做。 相反,它首先在没有授权领域的情况下发出GET申请。 如果它收到401部错误代码,并与WWWW-Authenticate油田做出反应,它就会向授权领域发出另一个GET申请。

虽然《吉大港山区行动计划》要求发出401个错误代码的回馈信息,以列入WWWW-Authenticate Field Pi 普森信息。 因此,即便在使用标准选择设定了RCurl的情况下,如果打电话getURL,则从来不会向GET申请发出授权领域。 因此认证总是失败。

是否有任何办法迫使RCurl在其发出的第一个GET信息中设立授权领域? 如果我看不出有什么其他的培训材料?

最佳回答

我先在Runurl、Duncan Lang作者的帮助下解决这个问题。 解决办法是明确制定“网上选择”,其中规定了最初尝试的认证方法。 这项工作:

getURL("https://api.picloud.com/job/?jids=12", userpwd="key:secret", httpauth = 1L) 

httpauth is a bitmask specifying which authentication methods to use. See the HTTP Authentication section of the libcurl tutorial for more details.

问题回答

h的对应法是:

library(httr)
GET("https://api.picloud.com/job/?jids=12", authenticate("key", "secret"))




相关问题
How to plot fitted model over observed time series

This is a really really simple question to which I seem to be entirely unable to get a solution. I would like to do a scatter plot of an observed time series in R, and over this I want to plot the ...

REvolution for R

since the latest Ubuntu release (karmic koala), I noticed that the internal R package advertises on start-up the REvolution package. It seems to be a library collection for high-performance matrix ...

R - capturing elements of R output into text files

I am trying to run an analysis by invoking R through the command line as follows: R --no-save < SampleProgram.R > SampleProgram.opt For example, consider the simple R program below: mydata =...

R statistical package: wrapping GOFrame objects

I m trying to generate GOFrame objects to generate a gene ontology mapping in R for unsupported organisms (see http://www.bioconductor.org/packages/release/bioc/vignettes/GOstats/inst/doc/...

Changing the order of dodged bars in ggplot2 barplot

I have a dataframe df.all and I m plotting it in a bar plot with ggplot2 using the code below. I d like to make it so that the order of the dodged bars is flipped. That is, so that the bars labeled "...

Strange error when using sparse matrices and glmnet

I m getting a weird error when training a glmnet regression. invalid class "dgCMatrix" object: length(Dimnames[[2]]) must match Dim[2] It only happens occasionally, and perhaps only under larger ...

Generating non-duplicate combination pairs in R

Sorry for the non-descriptive title but I don t know whether there s a word for what I m trying to achieve. Let s assume that I have a list of names of different classes like c( 1 , 2 , 3 , 4 ) ...

Per panel smoothing in ggplot2

I m plotting a group of curves, using facet in ggplot2. I d like to have a smoother applied to plots where there are enough points to smooth, but not on plots with very few points. In particular I d ...

热门标签