Closed phillc73 closed 3 years ago
loginBF() and keepAlive() functions updated to httr. Thanks to input from @willtudorevans @bcaneco on issue #21
loginBF function works fine using httr package instead of RCurl. Is there any chance of changing the logoutBF function to use httr as well?
@freddiec Yes, for sure I can look at converting that function next. I'm traveling for a few days, but will aim to do it next week.
Brilliant, much appreciated.
Sent from my iPad
On 6 Jun 2019, at 20:18, Phill notifications@github.com wrote:
@freddiec Yes, for sure I can look at converting that function next. I'm traveling for a few days, but will aim to do it next week.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Did you find time to take a look at converting the logoutBF() function to use httr instead of RCurl ? Betfair no longer recognises the original version. .Thanks.
@freddiec - the following might help you with logging out.
alternativeLogoutBF <- function(suppress = TRUE, sslVerify = TRUE){
if(suppress){
logout <- suppressWarnings(
as.list(
httr::content(
httr::POST(
url = "https://identitysso.betfair.com/api/logout", config = httr::config(ssl_verifypeer = sslVerify),
httr::add_headers(
Accept = "application/json",
`X-Application` = Sys.getenv("product"),
`X-Authentication` = Sys.getenv("token"),
`Content-Type` = "application/json"
)
)
)
)
)
} else(
logout <- as.list(
httr::content(
httr::POST(
url = "https://identitysso.betfair.com/api/logout", config = httr::config(ssl_verifypeer = sslVerify),
httr::add_headers(
Accept = "application/json",
`X-Application` = Sys.getenv("product"),
`X-Authentication` = Sys.getenv("token"),
`Content-Type` = "application/json"
)
)
)
)
)
return(paste0(logout$status, ":", logout$error))
}
Hi wetdog,Worked an absolute treat. Thank you very much for your help, you're a star !Regards,freddiec -----Original Message----- From: thewetdog notifications@github.com To: phillc73/abettor abettor@noreply.github.com CC: freddiec johnfcrump@aol.com; Mention mention@noreply.github.com Sent: Sun, 21 Jul 2019 13:55 Subject: Re: [phillc73/abettor] Change from using RCurl to httr (#11)
@freddiec - the following might help you with logging out.alternativeLogoutBF <- function(suppress = TRUE, sslVerify = TRUE){
if(suppress){
logout <- suppressWarnings(
as.list(
httr::content(
httr::POST(
url = "https://identitysso.betfair.com/api/logout", config = httr::config(ssl_verifypeer = sslVerify),
httr::add_headers(
Accept = "application/json",
X-Application
= Sys.getenv("product"),
X-Authentication
= Sys.getenv("token"),
Content-Type
= "application/json"
)
)
)
)
)
} else(
logout <- as.list(
httr::content(
httr::POST(
url = "https://identitysso.betfair.com/api/logout", config = httr::config(ssl_verifypeer = sslVerify),
httr::add_headers(
Accept = "application/json",
X-Application
= Sys.getenv("product"),
X-Authentication
= Sys.getenv("token"),
Content-Type
= "application/json"
)
)
)
)
)
return(paste0(logout$status, ":", logout$error))
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
Done, thanks to @Soccerama
The httr provides a much nicer and easier to user interface than RCurl. I'd like to change this package to use httr rather than RCurl.
See
backblazer
package for example: https://github.com/phillc73/backblazer/blob/master/R/b2AuthorizeAccount.R