Example of an httr oauth for the yahoo APIs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
# 1. Find OAuth settings for yahoo: | |
# Endpoints described here... | |
# http://developer.yahoo.com/oauth/guide/oauth-auth-flow.html | |
yahoo <- oauth_endpoint("get_request_token", "request_auth", "get_token", | |
base_url = "https://api.login.yahoo.com/oauth/v2/") | |
# 2. Register an application at... | |
# https://developer.apps.yahoo.com/dashboard/createKey.html | |
# Insert your values below - if secret is omitted, it will look it up in | |
# the YAHOO_CONSUMER_SECRET environmental variable. | |
myapp <- oauth_app("yahoo", key = "consumer.key here", | |
secret= "consumer.secret here") | |
# 3. Get OAuth credentials | |
token <- oauth1.0_token(yahoo, myapp) | |
# 4. Generate signature and make requests | |
sig <- sign_oauth1.0(myapp, token$oauth_token, token$oauth_token_secret) | |
GET("http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/standings", | |
sig) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment