使用ROAuth的twitteR代理身份验证

Prasanna Nandakumar

我正在尝试使用RStudio的twitteR软件包。
但是我收到一个错误:

有时需要“需要代理身份验证”-“找不到主机”。

有许多线程存在相同的问题。
我已经尝试了一切(--internet2,R by setting "~/Rgui.exe" http_proxy=http:/999.99.99.99:8080/ http_proxy_user=ask)。但这没有用。

在我的代码下找到我的代码(我正在从我的办公室桌面RStudio运行),该代码需要身份验证:proxyuserpwd="**domain//username:pwd**"

我不确定这条线。我尝试了各种组合,但均无效果。

rm(list=ls())
library(twitteR)
library(ROAuth)
library(RCurl)

options(RCurlOptions = list(
  verbose = TRUE,
  proxy ="http://proxy1.domain.com:8080",
  proxyuserpwd="domain//username:pwd",
  proxyauth="ntlm"))

reqURL <- "http://api.twitter.com/oauth/request_token"
accessURL <- "http://api.twitter.com/oauth/access_token"
authURL <- "http://api.twitter.com/oauth/authorize"
consumerKey <- '.............'
consumerSecret <- '..........'
twitCred <- OAuthFactory$new(consumerKey=consumerKey,
                          consumerSecret=consumerSecret,
                         requestURL=reqURL,
                         accessURL=accessURL,
                         authURL=authURL)

download.file(url="http://curl.haxx.se/ca/cacert.pem",destfile="cacert.pem")
twitCred$handshake(cainfo="cacert.pem")



< Proxy-Authenticate: BASIC realm="Access to this server requires AD Authentication.    Prefix your user ID with domain."
Host: api.twitter.com
Accept: */*
Proxy-Connection: Keep-Alive
Content-Length: 221
Content-Type: application/x-www-form-urlencoded

Error: Proxy Authentication Required
> registerTwitterOAuth(twitCred)
< HTTP/1.1 407 Proxy Authentication Required
* Authentication problem. Ignoring this.
< Proxy-Authenticate: NTLM
< Cache-Control: no-cache
< Pragma: no-cache
< Content-Type: text/html; charset=utf-8
* HTTP/1.1 proxy connection set close!
< Proxy-Connection: close
< Set-Cookie: BCSI-CS-3bf0ea03406bba28=2; Path=/
< Connection: close
< Content-Length: 899
< 
* Closing connection #0
Error in registerTwitterOAuth(twitCred) : 
oauth has not completed its handshake

但是,当我尝试以下代码时。

library("RCurl")
opts <- list(
proxy         = "proxy1.domain.com", 
proxyusername = "domain", 
proxypassword = "pwd",
proxyport     = 8080
)
getURL("http://stackoverflow.com", .opts = opts)

...我很成功。

>sessionInfo()  
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] twitteR_1.1.7  rjson_0.2.13   ROAuth_0.9.3   digest_0.6.3   RCurl_1.95-4.1    bitops_1.0-5  

loaded via a namespace (and not attached):
[1] tools_2.15.1

我从这里尝试了多线程解决方案,但它们的解决方案均无效。我不确定我在哪里犯错。(这是我需要与用户名一起困扰的域名)有人可以对此问题有所了解吗?

更新:

当我在RGui中运行相同的代码(设置“〜/ Rgui.exe” http_proxy = http:/999.99.99.99:8080 / http_proxy_user = ask)时,它提示输入用户名和密码来下载cacert.pem。
但是,当我尝试握手时,会引发相同的错误:

错误:需要代理身份验证。

更新:

我收到以下错误:
Error in function (type, msg, asError = TRUE) : Received HTTP code 407 from proxy after CONNECT

如托马斯建议的更新-尝试

reqURL <- "https://api.twitter.com/oauth/request_token"
accessURL <- "https://api.twitter.com/oauth/access_token"
authURL <- "http://api.twitter.com/oauth/authorize"
consumerKey <- '-----'
consumerSecret <- '-------'
twitCred <- OAuthFactory$new(consumerKey=consumerKey,
                         consumerSecret=consumerSecret,
                         requestURL=reqURL,
                         accessURL=accessURL,
                         authURL=authURL)

h <- getCurlHandle(
proxy         = "proxy1.domain.com", 
proxyusername = "username",  #but i have to always prefix my domain with username(Domain\username or domain\\username or domain//username)
proxypassword = "password",
proxyport     = 8080,
cainfo = "cacert.pem")
twitCred$handshake(curl=h)

我收到以下错误,
Error in strsplit(response, "&") : non-character argument
我正在更新具有追溯输出的链接
5: strsplit(response, "&")
4: lapply(X = X, FUN = FUN, ...)
3: sapply(strsplit(response, "&")[[1]], strsplit, "=")
2: parseResponse(resp)
1: twitCred$handshake(curl = h)

汤玛士

我真的对代理服务器一无所知,但是为什么不为握手行尝试一下(明确指定curl句柄):

h <- getCurlHandle(
      proxy         = "proxy1.domain.com", 
      proxyusername = "domain", 
      proxypassword = "pwd",
      proxyport     = 8080,
      cainfo = "cacert.pem")
twitCred$handshake(curl=h)

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

使用代理时,Weblogic中断CXF证书身份验证

来自分类Dev

ISP上的Web代理身份验证

来自分类Dev

使用Linq to Twitter使用OAuth进行身份验证

来自分类Dev

使用devise和twitter API的Twitter身份验证

来自分类Dev

使用鱿鱼代理的基本身份验证

来自分类Dev

Java代理身份验证(使用HttpURLConnection)

来自分类Dev

如何使用基本身份验证创建esb代理

来自分类Dev

Dropbox Java:将代理与身份验证配合使用

来自分类Dev

如何在经过身份验证的代理后面使用sbt?

来自分类Dev

如何使用硒在PhantomJS中设置代理身份验证?

来自分类Dev

使用Python使用Selenium设置chromedriver代理身份验证

来自分类Dev

使用Azure AD用户建立代理身份验证

来自分类Dev

RStudio代理身份验证

来自分类Dev

使用http代理进行git存储库身份验证

来自分类Dev

使用功能的代理身份验证

来自分类Dev

设置代理身份验证,例如使用Vbscript

来自分类Dev

身份验证API Twitter

来自分类Dev

Java代理身份验证(使用HttpURLConnection)

来自分类Dev

使用twitteR软件包自动进行身份验证

来自分类Dev

Twitter API身份验证

来自分类Dev

在Symfony中使用HWIOAuth进行Twitter身份验证

来自分类Dev

使用代理身份验证的twilio Java连接

来自分类Dev

使用 R 进行 Twitter 身份验证

来自分类Dev

关于使用 twitter 身份验证标头的错误身份验证数据

来自分类Dev

使用 PhantomJS 进行代理身份验证

来自分类Dev

使用passport.js 进行Twitter 身份验证

来自分类Dev

使用代理身份验证的 clamav 更新问题

来自分类Dev

在 cygwin 上使用 wget 进行代理身份验证

来自分类Dev

如何使用 CAS 身份验证设置 Express Gateway 代理

Related 相关文章

热门标签

归档