httr

Redirect in Shiny app

删除回忆录丶 提交于 2020-01-01 04:47:06
问题 I'm trying to make my Shiny app to redirect the user to another page. I'm using httr to send GET requests and see if the user is logged in. If he's not, I want to redirect him to another link. Can I do that using R / Shiny only, or do I need some extra libraries? sample: library(httr) library(shiny) shinyServer(function(input, output) { rv <- reactiveValues() rv$mytoken = session$request$token observeEvent(input$button1, { rv$a <- GET("my.url:3405/authtoken", add_headers( .headers = c("token"

How to specify certificate, key and root certificate with httr for certificate based authentication?

荒凉一梦 提交于 2019-12-30 10:35:42
问题 I am trying to access data using httr library from server which expects certificate based authentication. I have certificate (cert.pem), key file (key.pem) and root certificate (caroot.pem) Following curl works. curl -H "userName:sriharsha@rpc.com" --cert cert.pem --key certkey.key --cacert caroot.pem https://api.somedomain.com/api/v1/timeseries/klog?limit=1 How can specify certkey.key and caroot.pem to httr GET request. I am trying with following R command but couldn't find option to specify

how to download a large binary file with RCurl *after* server authentication

那年仲夏 提交于 2019-12-29 06:49:27
问题 i originally asked this question about performing this task with the httr package, but i don't think it's possible using httr . so i've re-written my code to use RCurl instead -- but i'm still tripping up on something probably related to the writefunction .. but i really don't understand why. you should be able to reproduce my work by using the 32-bit version of R, so you hit memory limits if you read anything into RAM. i need a solution that downloads directly to the hard disk. to start,

Scrape password-protected website in R

白昼怎懂夜的黑 提交于 2019-12-27 11:41:31
问题 I'm trying to scrape data from a password-protected website in R. Reading around, it seems that the httr and RCurl packages are the best options for scraping with password authentication (I've also looked into the XML package). The website I'm trying to scrape is below (you need a free account in order to access the full page): http://subscribers.footballguys.com/myfbg/myviewprojections.php?projector=2 Here are my two attempts (replacing "username" with my username and "password" with my

Scrape password-protected website in R

不想你离开。 提交于 2019-12-27 11:40:02
问题 I'm trying to scrape data from a password-protected website in R. Reading around, it seems that the httr and RCurl packages are the best options for scraping with password authentication (I've also looked into the XML package). The website I'm trying to scrape is below (you need a free account in order to access the full page): http://subscribers.footballguys.com/myfbg/myviewprojections.php?projector=2 Here are my two attempts (replacing "username" with my username and "password" with my

Why different results with XPath 1.0 and RCurl vs httr, using substring-before an expression

混江龙づ霸主 提交于 2019-12-25 08:57:48
问题 When I use XPath 1.0's substring-before or -after in an expression, something happens that makes my subsequent xmlValue call throw an error. The code below shows that the XPath expression works fine with httr, but then doesn't work with RCurl. require(XML) require(httr) doc <- htmlTreeParse("http://www.cottonbledsoe.com/CM/Custom/TOCContactUs.asp", useInternal = TRUE) (string <- xpathSApply(doc, "substring-before(//div[@id = 'contactInformation']//p, 'Phone')", xmlValue, trim = TRUE)) require

Issue with API call to Tradier using R with httr package

北慕城南 提交于 2019-12-24 22:34:30
问题 I'm trying to make an API call to tradier API, but get 401 error. Here's the link to their API: https://developer.tradier.com/documentation/markets/get-quotes And it's my simple code: library(httr) tradier <- "https://api.tradier.com/v1/markets/history?symbol=AAPL" getdata<-GET(url=tradier, add_headers(Authorization="Bearer XXXXXXXXXXXXXXXXX")) getdata 回答1: The sandbox API endpoint works for me. I guess for the brokerage API endpoint you have to upgrade your account. library(magrittr) library

How can I Scrape a CGI-Bin with rvest and R?

断了今生、忘了曾经 提交于 2019-12-24 07:19:25
问题 I am trying to use rvest to scrape the results of a webform that pop up in a cgi-bin. However when I run the script I get back 0 results within 200 miles as the result. Below is my code I appreciate any feedback and help. The main website is http://www.zmax.com/ that has the search box that launches the cgi-bin. library(rvest); library(purrr) ; library(plyr) ; library(dplyr) ; x<-read_html('http://www.nearestoutlet.com/cgi-bin/smi/findsmi.pl') y<-x%>% html_node('table')%>% html_table(fill

Disable Dialog Box - Save As - Rselenium

余生长醉 提交于 2019-12-24 01:12:55
问题 I'm using RSelenium on my MacBook to scrape publicly available .csv files. None of the other questions posed so far had answers that were particularly helpful for me. Please don't mark this as a duplicate. With respect to Firefox, I can't disable the dialog box. I've tried a number of different things. According to Firefox, the MIME type of the file I'm trying to download text/csv; charset=UTF-8 . However, executing the following code still elicits the dialog box to appear: fprof <-

POST encripted request with JSON body on R

扶醉桌前 提交于 2019-12-24 00:46:33
问题 I am trying to use R to post an encrypted request to an API. Specifically the /v3/orders/ request. It requires the use of an API key and secret , as well as an increasing nonce . Using openssl , jsonlite and httr libraries: The body has to be JSON encoded: book<-"btc_eth" side<-"sell" major<-"0.1" price<-"100" type<-"limit" Payload<-toJSON(data.frame(book=book,side=side,major=major,price=price,type=type)) It also requires an authorization header constructed with an sha256 encrypted signature