papagorgio23 / bettoR

R Package for Sports betting
https://papagorgio23.github.io/bettoR/
Other
64 stars 8 forks source link

All calls to get_lines() returning 463; add option to specify User-Agent? #9

Closed jimtheflash closed 1 year ago

jimtheflash commented 3 years ago

All calls I'm making to get_lines() are returning error code 463. For example:

> bettoR::get_lines(start_date = "20210201")
Error in open.connection(x, "rb") : HTTP error 463.

This is the case running locally as well as in RStudio Cloud (happy to provide system info and loaded libraries, but I don't think those are really the issue here).

However, visiting the URL https://classic.sportsbookreview.com/betting-odds/?date=20210201 in my browser works just fine.

Would it be possible to specify the user-agent when grabbing data from SBR? It may be the case that non-browser agents are being blocked.

jimtheflash commented 3 years ago

per twitter DM convo, I'm gonna go ahead and cut a branch and make a PR for this, hopefully by EOW. Looks like this can be done using functions in httr for specifying the headers prior to calling xml2::read_html().

jimtheflash commented 3 years ago

Pull request #10 created to address issue - turns out not necessarily anything with user-agent, but seems to work by adding httr::GET() prior to invoking xml2::read_html(). Will close out after PR process completes.