httr

How to POST multipart/related content with httr (for Google Drive API)

混江龙づ霸主 提交于 2019-12-19 19:03:11
问题 I got simple file uploads to Google Drive working using httr. The problem is that every document is uploaded as "untitled", and I have to PATCH the metadata to set the title. The PATCH request occasionally fails. According to the API, I ought to be able to do a multipart upload, allowing me to specify the title as part of the same POST request that uploads the file. res<-POST( "https://www.googleapis.com/upload/drive/v2/files?convert=true", config(token=google_token), body=list(y=upload_file

Posting to and Receiving data from API using httr in R

我是研究僧i 提交于 2019-12-19 04:23:23
问题 I'm trying to access the US Census Geocoder batch address API, found here: http://geocoding.geo.census.gov/geocoder/ I've also gone through the documentation for the API here: http://geocoding.geo.census.gov/geocoder/Geocoding_Services_API.pdf I'm trying to use the httr package in R to post a batch csv file of formatted addresses using this format: Unique ID, Street address, City, State, ZIP I've tried the single address request version using getURL from RCurl and that works fine, but

automating the login to the uk data service website in R with RCurl or httr

喜你入骨 提交于 2019-12-18 11:07:11
问题 I am in the process of writing a collection of freely-downloadable R scripts for http://asdfree.com/ to help people analyze the complex sample survey data hosted by the UK data service. In addition to providing lots of statistics tutorials for these data sets, I also want to automate the download and importation of this survey data. In order to do that, I need to figure out how to programmatically log into this UK data service website. I have tried lots of different configurations of RCurl

How to properly set cookies to get URL content using httr

那年仲夏 提交于 2019-12-18 06:56:18
问题 I need to download information from web site that is protected using cookies. I pass this protection manually and then insert cookies to httr . Here is similar topic, but it does not solve my problem: (Copying cookie for httr) library(httr) url<-"http://smida.gov.ua/db/emitent/year/xml/showform/32153/125/templ" cook<-"_SMIDA=9117a9eb136353bd6956651bd59acd37; __utmt=1; __utma=29983421.1729484844.1413489369.1413625619.1413627797.3; __utmb=29983421.7.10.1413627797; __utmc=29983421; __utmz

Census Batch Geocoding API with source addresses in data frame (not CSV) in R

拈花ヽ惹草 提交于 2019-12-14 03:42:48
问题 I am attempting to utilize the Census Bureau's batch geocoder (http://geocoding.geo.census.gov/geocoder/Geocoding_Services_API.pdf) with R. The input addresses are in a data frame, not a CSV. As the addresses are an intermediate step, I do not want to write them to a CSV. I have read several postings on stackoverflow. Hadley's solution (Posting to and Receiving data from API using httr in R) illustrates how to upload an existing CSV file. MrFlick's solution (Uploading a csv to an api in R)

bind character vector to list into dataframe

只愿长相守 提交于 2019-12-14 03:18:30
问题 I have a list of URLs and have extracted the content as follows: library(httr) link="http://www.workerspower.net/disposable-workers-the-real-price-of-sweat-shop-labor" get.link=GET(link) get.content=content(x2,as="text") extract.content=str_extract_all(y2,"<p>(.*?)</p>") This gives a "list of 1" with text. The length of each list is dependent on/varies with the URL. I would like to bind the URL [link] with the content [extract.content] and transform it into a dataframe and then import that

Accessing Spotify API for Multiple Artists in R

独自空忆成欢 提交于 2019-12-14 00:25:38
问题 I have created a Client ID and Secret Key in Spotify's developer app section. I am referencing this document and want to extend this by choosing multiple artists. https://www.r-bloggers.com/the-eurovision-2016-song-contest-in-an-r-shiny-app/ In this example, they are only choosing 1 artist ID but there are some holes to this, 1) How do you obtain the artist name rather than the artist ID because I can't find a glossary key anywhere for the artist ID? 2) How do you choose multiple artists

RCurl on OS X El Capitan -9806 Error

时光毁灭记忆、已成空白 提交于 2019-12-13 02:47:51
问题 I am trying to use RCurl for an oauth 2 authentication. My code is: library(RCurl) myOpts <- curlOptions(httpheader = c(Accept="application/json", "Content-Type"="application/x-www-form-urlencoded")) token <- postForm(authURL, .params = list( client_id ="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client_secret = "bbbbbbbbbbbbbbbbbbbbbbbbbbbb", username = "xxxxx@yyyy.zzz", password = pswd), .opts = myOpts, style="POST") The code works just fine on R/Windows, but not on OS X El Capitan. On OS X, I get the

android package - R.attr nested class — employing an api key

蓝咒 提交于 2019-12-13 02:22:53
问题 I trying to imitate a CURL request using the HTTR package in R. It's for propbulica's election API. propublica.github.io/campaign-finance-api-docs/ The command line request is documented as follows: curl "https://api.propublica.org/campaign-finance/v1/2016/president/totals.json" -H "X-API-Key: PROPUBLICA_API_KEY" My imitation of this in using R is as follows: require(httr) api_key <- "my key" path <- "https://api.propublica.org/campaign-finance/v1/2016/president/totals.json" data <- GET(path,

Ignore SSL errors in R httr connection

风格不统一 提交于 2019-12-12 11:07:53
问题 Updated: I am trying to access a corporate internal web API using: require(httr) url = 'https://my_server/api/search/query?q=stuff' httr::set_config( config(ssl_verifypeer = 0L) ) data <- httr::GET( url, use_proxy(url = "ipaddress:port"), verbose() ) I get: -> CONNECT my_server:port HTTP/1.1 -> Host: my_server:port -> User-Agent: libcurl/7.47.1 r-curl/0.9.7 httr/1.1.0 -> Proxy-Connection: Keep-Alive -> <- HTTP/1.1 200 Connection established <- Error in curl::curl_fetch_memory(url, handle =