httr

How to make a POST request with header and data options in R using httr::POST?

给你一囗甜甜゛ 提交于 2019-12-04 06:44:12
问题 I am trying make a POST request with data and header information using httr::POST . I can see how to make a POST request, but I am unable to get it to work with curl's data ( -d ) and header ( -H ) options. This works perfectly in my terminal (obviously with different data/api, but exactly the same format) curl -H "Accept: application/json" -H "Content-type: application/json" -d '{"name": "Fred", "age": "5"}' "http://www.my-api.com" Question How can the above POST request be made (with

R: use rvest (or httr) to log in to a site requiring cookies

喜你入骨 提交于 2019-12-04 01:49:14
问题 I'm trying to automate the shibboleth-based login process for the UK Data Service in R. One can sign up for an account to login here. A previous attempt to automate this process is found in this question, automating the login to the uk data service website in R with RCurl or httr. I thought the excellent answers to this question, how to authenticate a shibboleth multi-hostname website with httr in R, were going to get me there, but I've run into a wall. And, yes, RSelenium provides an

Authenticating google sheets on AWS Ubuntu without browser

筅森魡賤 提交于 2019-12-03 21:30:20
I'm running R Studio on an AWS "Ubuntu Server 12.04.2" and accessing R Studio via my browser. When I try to authenticate google auth API using the package googlesheets with the code: gs_auth(token = NULL, new_user = FALSE, key = getOption("googlesheets.client_id"), secret = getOption("googlesheets.client_secret"), cache = getOption("googlesheets.httr_oauth_cache"), verbose = TRUE) The problem here is that it redirects me to browser which is of local machine (windows based). Even if I authorize it, it redirects to a URL like " http://localhost:1410/?state=blahblah&code=blahblah ". How do I

Yahoo login using rvest

感情迁移 提交于 2019-12-03 20:39:02
Recently, Yahoo changed their authentication mechanism to a two step one. So now, when I login to a yahoo site, I put in my username, and then it asks me to open my yahoo mobile app to give it a code. Alternatively, you can have it email or text you some other way around this. The result of this is that code that used to work to programatically login to Yahoo sites no longer works. This code just redirects to the login form. I've tried with and without a useragent string and with and without the countrycode=1 in the form values. I'm fine with entering a code after looking at my mobile app, but

R + httr and EC2 api authentication issues

烂漫一生 提交于 2019-12-03 16:08:45
I would like to use the R package httr to access the EC2 services via their API. But I am a little bit unsure how to get started as it does not fall into the usual authentication format of "Oauth2.0" in which you have the usual: key, secret, token and signature system. I think EC2 uses the "signature version 2" method, but I am unclear as to how that works. Looking at the documentation that EC2 provides with regard to making query requests at http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/using-query-api.html I think I need the value for signature....but don't know how to get it I

R: Emulating a complex form with httr

本小妞迷上赌 提交于 2019-12-03 16:05:51
I am trying to get the results of that form with httr . Having looked the form results , I tried the following: library(httr) library(stringr) r = str_c("http://www.memoiredeshommes.sga.defense.gouv.fr/fr/arkotheque/", "client/mdh/base_morts_pour_la_france_premiere_guerre/index.php") q = list( "action" = 1, "todo" = "rechercher", "le_id" = "", "multisite" = "", "r_c_nom" = "mo", "r_c_nom_like" = 1, "r_c_prenom" = "", "r_c_prenom_like" = 1, "r_c_naissance_jour_mois_annee_jj_debut" = "", "r_c_naissance_jour_mois_annee_mm_debut" = "", "r_c_naissance_jour_mois_annee_yyyy_debut" = 1890, "r_c

Asynchronous POST Requests - R, using RCurl?

拜拜、爱过 提交于 2019-12-03 15:01:24
问题 I am trying to make async requests to a REST API from R. The below curl command illustrates the parameters that I need to the pass to the api. I'm giving you guys the linux curl command as I'm hoping that will make it clear: curl -v -X POST https://app.example.com/api/ \ -H 'Authorization: somepwd' \ -H "Content-Type: application/json" \ -d {key1: value1, key2: value2} Right now, I'm accomplishing the same thing in R by executing the following: library(httr) library(jsonlite) content(POST(

How correctly use request header with API data requests?

一曲冷凌霜 提交于 2019-12-03 14:06:26
I'm trying to find the way to connect to Appannie's API with R using the httr package (have no experience with API connection at all). The API requires to include the request header Citation from appannie's site: Register an App Annie account and generate an API key. Add this key to your request header as follows: Authorization: Bearer '' citation over I wrote the code which looks like this query <- "http://api.appannie.com/v1/accounts/1000/sales?break_down=application+dat &start_date=2012-01-01 &end_date=2012-02-01 &currency=USD &countries=US &page_index=1" getdata<-GET(url=query, add_headers

How to download a file behind a semi-broken javascript asp function with R

℡╲_俬逩灬. 提交于 2019-12-03 11:39:51
问题 I am trying to fix a download automation script that I provide publicly so that anyone can easily download the world values survey with R. On this web page - http://www.worldvaluessurvey.org/WVSDocumentationWV4.jsp - the PDF link "WVS_2000_Questionnaire_Root" easily downloads in firefox and chrome.I cannot figure out how to automate the download with httr or RCurl or any other R package. screenshot below of the chrome internet behavior. That PDF link needs to follow through to the ultimate

r language support for AWS DynamoDB [duplicate]

六眼飞鱼酱① 提交于 2019-12-03 08:49:35
This question already has answers here : AWS dynamodb support for “R” programming language (3 answers) This is a follow up / updated question to this: AWS dynamodb support for "R" programming language I am looking for examples or documentation on how to read in a table from DynamoDB into R. This question pointed me in the right direction: R + httr and EC2 api authentication issues (answered by the great @hadley himself!). It's ok if I have to use httr and then parse a json response, but I can't even figure out how to format the POST request. Thanks! CalZ Repeating my answer from here since