v3.0.0
This v3.0.0
release of the DraftKings client improves on the internals of the client while also (hopefully) providing a nicer output API for developers.
The use of the marshmallow
library
The marshmallow
library is used to deserialize the response from draftkings.com
endpoints into data class objects.
These classes use the dataclasses
module introduced in Python 3.7
.
These data objects are then processed / transformed into data class objects exposed by the client's public API.
Outputting objects
A breaking change from v2.x
is that the client now returns explicit classes vs. dict
s.
This is done for two reasons
- Using explicit classes makes it easier to use type hinting when reading data from the client (as well as making the developer experience better when working on changes inside the project, IMHO)
marshmallow
+ explicit classes makes it easy to take a class instance and serialize it into some other format (like plain olddict
s orJSON
)
Client class
vs. exported functions
Another breaking change from v2.x
is that in v2.x
, the API was a series of functions that could be imported from a module.
In v3.0.0
, the proper way of using the API is to import the Client
from the draft_kings
module, instantiate it, and then call the relevant methods on the instantiated Client
instance.