Code Monkey home page Code Monkey logo

nbatools's People

Contributors

ccagrawal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nbatools's Issues

API calls hang with no return (header changes?)

It appears that functions are hanging again and not returning the expected dataframes. More than likely due to header changes. I've been using another package (nbastatsr) that uses the following headers:

 headers <- c(
    `Host` = 'stats.nba.com',
    `User-Agent` = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv =72.0) Gecko/20100101 Firefox/72.0',
    `Accept` = 'application/json, text/plain, */*',
    `Accept-Language` = 'en-US,en;q=0.5',
    `Accept-Encoding` = 'gzip, deflate, br',
    `x-nba-stats-origin` = 'stats',
    `x-nba-stats-token` = 'true',
    `Connection` = 'keep-alive',
    `Referer` = 'https =//stats.nba.com/',
    `Pragma` = 'no-cache',
    `Cache-Control` = 'no-cache'
  )

If possible, could you give this header a try to see if it fixes the hanging API calls? The other package that I'm using unfortunately does not have a function for the synergytables that I'm after.

Thank you!
DT

NBA API headers change

Yesterday I tried running the GetGameLogs function and in return I did not get an output (same thing today). The function just hangs for a while and does not return the expected game logs. I've been following the same issue as reported in the nba_api for Python and the issues seems to be related to the fact that NBA API headers have changed (again). I manually added the following fields to the headers and the function returned the expected game logs:

    'x-nba-stats-origin' = 'stats',
    'x-nba-stats-token' = 'true'

Working NBA headers:

  'NBA' = list(
    'Accept' = 'application/json, text/plain, */*',
    'Accept-Language' = 'en-US,en;q=0.8,af;q=0.6',
    'Referer' = 'http://stats.nba.com/%referer%/',
    'User-Agent' = paste('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6)',
                         'AppleWebKit/537.36 (KHTML, like Gecko)',
                         'Chrome/67.0.3396.99 Safari/537.36'),
    'x-nba-stats-origin' = 'stats',
    'x-nba-stats-token' = 'true'
  ) 

I'm not familiar with how GitHub works as far as making changes to other people's work. I figured if I made you aware of the change in the headers and the fix it would be easy for you to update the package on your end with the new headers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.