requestsR
: Python’s Requests module for R
Ref: http://docs.python-requests.org/
Ref: https://asbcllc.com/r_packages/requestsR/docs/index.html
“Requests is an elegant and simple HTTP library for Python {and now R}, built for human beings. You are currently looking at the documentation of the development release..”
R has a number of great packages for interacting with web data but it still lags behind Python in large part because of the power and ease of use of the Requests module.
This package aims to port those powers to R, I like to think of this package as the Bo Jackson of web interaction tools.
It is fast, agile, powerful, clean and now it plays 2 languages!
. This is not intended to replace httr
, curl
, rvest
, or whatever
package you use to interact with web data. In fact, in many cases you
will want to use requestsR
in concert with those packages, especially
curl
and rvest
. I have found that requestsR
comes in most handy
for very complex web scraping tasks that require multiple headers,
parameters and cookies.
This package requires Python and the requests
module.
To install Requests in R you can run:
system("pip install requests")
import_requests
: imports requests module for full use in RGet
: mimics python get requestPost
: mimics python post request
Head
: mimics python head requestDelete
: mimcs python delete requestPut
: mimics python put request
convert_dictionary_to_list
: converts dictionary to listparse_response_html
: parses html from response objectparse_response_json
: parses JSON from response object
devtools::install_github("abresler/requestsR")
options(width=120)
Please feel free to take a look at this blog post demonstrating how to use the package.