sportsdataverse / hoopR

An R package to quickly obtain clean and tidy men's basketball play by play data.
http://hoopr.sportsdataverse.org/
Other
81 stars 18 forks source link

Cannot load KenPom data with subscription. #103

Closed mjaldin closed 10 months ago

mjaldin commented 1 year ago

Describe the bug I am trying use the Login function for kenpom thru R and it always outputs "Error in .kp_headers() : could not find function ".kp_headers"". I loaded the envirnoment to be KP_USER = YOUR-EMAIL@DOMAIN.COM KP_PW = XXX-YOUR-PASSWORD-XXX but idk why it is giving me the error message here. Any help would be greatly appreciated!

To Reproduce Steps to reproduce the behavior:

  1. Go to R
  2. load hoopR
  3. try 'login' function with Kenpom login info
  4. Error outputs

Desktop (please complete the following information): OS: Microsoft Windows 11 parallels R version: 4.2.2

shulmansj commented 1 year ago

I'm experiencing the same issue.

packageVersion('hoopR') [1] ‘1.9.1’

has_kp_user_and_pw() [1] TRUE

login() Error in read_html.response(x$response, ..., base_url = x$url) : Forbidden (HTTP 403). In addition: Warning message: In session_set_response(x, resp) : Forbidden (HTTP 403).

box <- kp_box(2017) Error in kp_box(2017) : object 'kenpom' not found`

OS: Mac R version: 4.2.2

sportfoliokings commented 1 year ago

We are experiencing same issue.

Deschaine17 commented 1 year ago

Same issue here, too

dominicvogel commented 11 months ago

@shulmansj @sportfoliokings @Deschaine17 did any of you ever figure this out? I'm having the same issue

shulmansj commented 11 months ago

@dominicvogel no I never did, but according to the changelog there were some KP related fixes included in subsequent releases. I'll take another shot at it

saiemgilani commented 11 months ago

So apologies for never getting back to you on this. First things, I need to point you to the documentation for kp_box().

The function requires the game_id parameter first, then year. While I can't point you to a direct function that gives you every single kenpom game_id, you can get it by looping through the kp_fanmatch() function for every date, or through every team's kp_team_schedule()

While he appears to have made some changes to his game ID'ing, it used to be just a 1-N numbering of games each season, which is the reason the function requires the year parameter primarily.

While there were some issues with the kenpom login process due to {httr}/{rvest} library changes loosely mentioned in the changelog, I do not believe this has any relation to that.