gpt4 book ai didi

r - 如果我是唯一的用户,请避免 ROAuth 握手中的 PIN 步骤?

转载 作者:行者123 更新时间:2023-12-05 00:32:15 25 4
gpt4 key购买 nike

问题 :有没有办法避免在进行 OAuth 握手时手动输入 PIN 码?

语境 :在进行 ROAuth 握手时,我被要求输入通过以下链接获得的 PIN:

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

Credentials <- OAuthFactory$new(
consumerKey = "...",
consumerSecret = "...",
oauthKey = "...",
oauthSecret = "...",
requestURL = "https://api.twitter.com/oauth/request_token",
authURL = "https://api.twitter.com/oauth/authorize",
accessURL = "https://api.twitter.com/oauth/access_token")

Credentials$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))

哪些输出:

Credentials$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")) To enable the connection, please direct your web browser to: https://api.twitter.com/oauth/authorize?oauth_token=... When complete, record the PIN given to you and provide it here:



我输入了一个 PIN。

我想避免这一步,因为每次我在新的 R session 中运行脚本时,我都必须手动打开浏览器来检索 PIN。我是唯一使用这个脚本的人。

最佳答案

执行握手后,您可以将对象保存到文件...

save(Credentials, file="credentials.RData")

稍后您可以使用 load() 将文件拉入并使用您的原始 Credentials 对象。

关于r - 如果我是唯一的用户,请避免 ROAuth 握手中的 PIN 步骤?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13746410/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com