phillc73 / abettor

An R package for connecting to the online betting exchange Betfair, via their API-NG product, using JSON-RPC.
Other
51 stars 36 forks source link

Unable to logout #24

Closed roseypro closed 3 years ago

roseypro commented 4 years ago

Hi Phill When trying to use logoutBF(), I get this message returned:

Error in function (type, msg, asError = TRUE) : error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

Am able login successfully. Error message is returned when sslVerify is set to F or T.

Thanks Chris

Soccerama commented 3 years ago

I think the updates should have solved this issue and you can now log out - it worked for me when I was testing it.

roseypro commented 3 years ago

Thanks for your work on the update to httr. I'm actually getting a different message with the new update. When running logoutBF() I get: No encoding supplied: defaulting to UFT-8 and then the function just returns the colon ":" is this something you have seen? As far as I can tell it is actually logging out, just not returning any confirmation/error string.

phillc73 commented 3 years ago

In general, to fix the No encoding supplied: defaulting to UTF-8 warning we need to add encoding = "UTF-8" tohttr::content`

However, the Betfair API logout endpoint is different to most of the other API calls, and just returns a character string. The current httr code isn't dealing with this character string very well and needs to be updated to read the success or error messages.

I'll try to look into that in the next days.

Or we could revert to RCurl!

roseypro commented 3 years ago

haha

I have changed the as = "text" in the httr:content() call, to as = "parsed" and am getting the "SUCCESS:" message for the logout function. Seems to have worked - it also gives the "FAIL:NO_SESSION" when using it and not logged in, as we would expect.

phillc73 commented 3 years ago

How about that...... I just updated the whole function with 44eef6320002236df4469f99998e7dcb60132d

Both approaches seem to work. Maybe yours is more elegant as it changes less code.

phillc73 commented 3 years ago

@roseypro Went with your solution instead. Committed in efd7df4e646106b57e006497cc4eb00ab260c418