httr

Using oauth2.0 tokens with R's httr package

…衆ロ難τιáo~ 提交于 2019-12-12 08:48:32
问题 Problem The package httr provides CURL wrappers in R (see package documentation). I'm brand new to HTTP and APIs. My trouble is getting oauth2.0 authentication to work. I have tried various syntax specifications and get either errors or status 401. What is the correct way to use an oauth2.0 token and make a GET() request using httr ? Code Attempts # Set UP url = "https://canvas.{institution}.edu/api/v1/courses" key = "{secret_key}" # 1 GET(url, sign_oauth2.0(key)) # Error: Deprecated: supply

If-Modified-Since not considered while using httr GET?

拥有回忆 提交于 2019-12-12 05:09:27
问题 My requirement/objective: I'm retrieving Facebook posts for the past 3 months from a public page, and I would like to select only those posts which have been modified in the recent past (in the last 2 days). I'm using httr R package, and using the GET function to accomplish the above. I tried the following : url.data <- GET(url, config(token=token), config(add_headers("If-Modified-Since" = "2016-09-08 11:45"))) url.data <- GET(url, config(token=token, add_headers("If-Modified-Since" = "2016

R httr POST request for signing in

不羁的心 提交于 2019-12-12 04:59:17
问题 I'm trying to log into bondora.com with using R httr POST request, because this site does not appear to be using authentication: library(httr) login <- "https://www.bondora.com/en/login" pars <- list( username = "MyUserName", password = "MyPassword" ) POST(login, body = pars) After logging in, the website directs the user back to landing page bondora.com/en/home, but instead if I parse the the POST request I get the same title for the page as the one from the login page: library(XML) test <-

R Download .csv file tied to input boxes and a “click” button

独自空忆成欢 提交于 2019-12-12 04:07:22
问题 I am attempting to download a .csv file from https://www.fantasysharks.com/apps/bert/forecasts/projections.php? that is tied directly the input settings (is not a static download link) and load it into R. After the drop boxes are filled in, you then have to click on the download .csv button. I found this Using R to "click" a download file button on a webpage that details a bit how to do it using POST, but am unable to get it to work with some modifications to that code. I have attempted this

How to POST multipart binary & non-binary with httr (for Salesforce API)

核能气质少年 提交于 2019-12-12 03:33:59
问题 I'm having some trouble using httr to POST a file to Salesforce's REST API. I thought this SO question might take care of it, but didn't seem to. I have a hunch that this is because Saleforce wants a non-binary part and upload_file creates an object of class form_file that's handled as a binary, but maybe someone has an alternate explanation/solution... Salesforce asks for the following curl request to insert a new document: curl https://yourInstance.salesforce.com/services/data/v23.0

Post XML form using httr

∥☆過路亽.° 提交于 2019-12-11 20:38:44
问题 I am trying to POST an xml object using httr In my application, I am creating the XML object like this: doc <- htmlTreeParse(conts, useInternalNodes = T) xmlFormula <- xpathSApply(doc, "//*/textarea", xmlValue) x <- xmlParseString(xmlFormula) Then I modify the xml on the fly and now want to post it using httr without saving it to disk and uploading from a file POST(MYURL, body=x) # this won't work Is there a method to make the xml object httr friendly? 来源: https://stackoverflow.com/questions

Copying cookie for httr

寵の児 提交于 2019-12-11 18:51:07
问题 I'm trying to access a site that sets a cookie on the basis of what type of visitor: library(httr) url <- "https://www.blackrock.com/ca/individual/en/products/product-list#categoryId=1&lvl2=overview" Essentially everything I've tried returns the this...: GET(url) Response [https://www.blackrock.com/ca/individual/en/site-entry?targetUrl=%2Fca%2Findividual%2Fen%2Fproducts%2Fproduct-list%3FsiteEntryPassthrough%3Dtrue] Status: 200 Content-type: text/html;charset=UTF-8 Size: 270 kB <!DOCTYPE html>

R httr GET request 400 error GDAX

柔情痞子 提交于 2019-12-11 16:10:48
问题 I am trying to hit GDAX using R and getting the following issue. How do I solve for the issue using httr . Response [https://api-public.sandbox.gdax.com/accounts] Date: 2017-12-07 20:30 Status: 400 Content-Type: application/json; charset=utf-8 Size: 53 B Below is my code. Please note that the issue exists only with httr package and not with RCurl (code provided in appendix) library(digest) library(httr) library(RCurl) # for base64Decode url <- "https://api-public.sandbox.gdax.com/accounts"

How to webscrap data if rvest functions don't work? (R)

筅森魡賤 提交于 2019-12-11 14:17:23
问题 I am trying to extract data from https://www.oneroof.co.nz/estimate/13c-caronia-crescent-lynfield-auckland-city-143867 . I would like to get estimated property value, rental price, floor area etc but failed to extract them. I am using R and tried something like this but didn't work.. 'https://www.oneroof.co.nz/estimate/13c-caronia-crescent-lynfield-auckland-city-143867' %>% read_html() %>% html_nodes(xpath = '//*[@id="app"]/div[1]/div[2]/div[2]/div[6]/div/div[3]/div[9]/div[2]/text()[1]') %>%

R - Write a HTML file from URL/HTML Object/HTML Response

旧城冷巷雨未停 提交于 2019-12-11 13:07:07
问题 I want to save a HTML file using a URL from R. I have tried to save the response object(s) after using GET and read_html functions of httr and rvest packages respectively, on the URL of the website, I want to save the HTML of. But that didn't work out to save the actual contents of the website. url = "https://facebook.com" get_object = httr::GET(url); save(get_object, "file.html") html_object = rvest::read_html(url); save(html_object, "file.html") Neither of these work to save the correct