thunky-monk / kawhi Goto Github PK
View Code? Open in Web Editor NEWstats.nba.com library :basketball:
License: MIT License
stats.nba.com library :basketball:
License: MIT License
When I run the example, this is what I see:
~/kawhi/example$ stack exec kawhi-example
kawhi-example: HttpExceptionRequest Request {
host = "stats.nba.com"
port = 80
secure = False
requestHeaders = []
path = "/stats/teamdashboardbygeneralsplits"
queryString = "?Conference&DateFrom&DateTo&Division&GameScope&GameSegment&LastNGames=0&LeagueID=00&Location&MeasureType=Advanced&Month=0&OpponentTeamID=0&Outcome&PaceAdjust=N&PerMode=PerGame&Period=0&PlayerExperience&PlayerPosition&PlusMinus=N&PORound=0&Rank=N&Season=2015-16&SeasonSegment&SeasonType=Regular%20Season&ShotClockRange&StarterBench&TeamID=1610612759&VsConference&VsDivision"
method = "GET"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutDefault
requestVersion = HTTP/1.1
}
ResponseTimeout
Any idea what could be causing this?
Not sure what triggered this failure:
> /tmp/stackage-build9/kawhi-0.2.0$ dist/build/tests/tests
Data.NBA.Stats
show (StatsResponseDecodeFailure message) == "StatsError (StatsResponseDecodeFailure message)": OK (0.02s)
206 tests completed
show (SplitNameNotFound message) == "StatsError (SplitNameNotFound message)": OK (0.04s)
206 tests completed
show (SplitKeyNotFound message) == "StatsError (SplitKeyNotFound message)": OK (0.02s)
206 tests completed
show (SplitColumnNameNotFound message) == "StatsError (SplitColumnNameNotFound message)": OK (0.03s)
206 tests completed
show (SplitRowCardinalityInconsistent message) == "StatsError (SplitRowCardinalityInconsistent message)": OK (0.01s)
206 tests completed
show (SplitRowParseFailure message) == "StatsError (SplitRowParseFailure message)": OK (0.02s)
206 tests completed
Get stat -> Success: OK
Get stats -> Success: OK
Get stat -> SplitRowCardinalityInconsistent: OK
Get stat -> SplitKeyNotFound (no rows): OK
Get stat -> SplitKeyNotFound (no key value): OK
Get stat -> SplitKeyNotFound (JSON parse error for key value): OK
Get stat -> SplitNameNotFound: OK
Get stat -> SplitColumnNameNotFound: OK
Get stat -> SplitRowParseFailure (type mismatch): FAIL
expected: StatsError (SplitRowParseFailure failed to parse field A: expected Integral, encountered String)
but got: StatsError (SplitRowParseFailure expected Integer, encountered String)
Get stat -> SplitRowParseFailure (missing field): OK
Get stat -> StatsResponseDecodeFailure (for Stats): OK
parseJSON invalid :: Parser Split -> Error: OK
1 out of 18 tests failed (0.11s)
Hey, sorry to bother you (again 😆) but I still have a problem.
The example now works fine for me, but the way I was actually trying to use kawhi
was to get the stats.nba.com scoreboard endpoint, which still fails for me using this package. I think it might be because the request has no Referer
header, as that seems to be required.
I totally get that things like this probably change all the time (as it's a very unstable API). Have you considered exporting a pure version of getSplitRows
so that users of the library can make the request themselves?
kawhi > /tmp/stack-930e93223b6b89bd/kawhi-0.3.0/library/Data/NBA/Stats.hs:303:63: error:
kawhi > • Couldn't match type ‘Text.Text’ with ‘Aeson.Key’
kawhi > Expected: [Aeson.Pair]
kawhi > Actual: [(SplitColumn, Aeson.Value)]
kawhi > • In the first argument of ‘Aeson.object’, namely
kawhi > ‘(zip columns row)’
kawhi > In the second argument of ‘($)’, namely
kawhi > ‘Aeson.object (zip columns row)’
kawhi > In the expression:
kawhi > Aeson.parse Aeson.parseJSON $ Aeson.object (zip columns row)
kawhi > |
kawhi > 303 | then case Aeson.parse Aeson.parseJSON $ Aeson.object (zip columns row) of
kawhi > | ^^^^^^^^^^^^^^^
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.