Package: oddsjam-api
oddsjam-api: A lightweight OddsJam API wrapperV2 UpdateV2 support is now available for the new endpoints/models listed at theOddsJam Developer Page.  The client exposed by this package is backwards compatible, and runs in v1 by default. Versions can be switched as follows:fromOddsJamClientimportOddsJamClient;Client=OddsJamClient(YOUR_API_KEY);v1Results=Client.GetLeagues();#Default v1 endpointsClient.UseV2();v2Results=Client.GetLeagues();#v2 endpointsThis update comes with the following changes:Type hinting for function calls is no longer available. Function calls will appear with(*args: Any, **kwargs:Any) -> Any. Please refer to the developer documentation for valid arguments.The V2 client doesnotcontain a GetMarkets() function.The V2 client requiresat least oneargument for the GetOdds() function. This is due to the amount of data returned from the new V2 endpoint. Attempting a call to GetOdds()withouta parameter will result in anInvalidGetOddsV2Error, and the endpoint willnotbe hit.What isoddsjam-api?oddsjam-apiis a fast, lightweight wrapper for theOddsJam API. It strives to be as intuitive to use as possible, providing strongly typed requests and responses to ensure predictability and consistency.How do I use it?Start by installing theoddsjam-apipackage (currently only on TestPyPI):pip install oddsjam-apiCreate an instance of theOddsJamClient:fromOddsJamClientimportOddsJamClient;Client=OddsJamClient(YOUR_API_KEY);Then simply call whichever function you'd like to:fromOddsJamClientimportOddsJamClient;Client=OddsJamClient(YOUR_API_KEY);GamesResponse=Client.GetGames();Parameters are not required for any function call, but can be provided as desired:fromOddsJamClientimportOddsJamClient;Client=OddsJamClient(YOUR_API_KEY);GamesResponse=Client.GetGames(league='ncaa',sport='football');Parameters will raise specific errors:GamesResponse=Client.GetGames(sport='curling');#Raises SportError, with a list of valid valuesOddsResponse=Client.GetOdds(sportsbook='212 Bet');#Raises SportsBookError, with a list of valid valuesNote: Sport and SportsBook parameters arecase insensitiveAccessing the object of a response requires accessing the response's object:fromOddsJamClientimportOddsJamClient;Client=OddsJamClient(YOUR_API_KEY);GamesResponse=Client.GetGames();Games=GamesResponse.Games;List comprehension can also be used to access objects:AwayTeams=[g.away_teamforginGamesResponse.Games];Nested objects can be accessed similarly:OddsResponse=Client.GetOdds();print(OddsResponse.Odds[0].game.sport)The raw response from the API is also accessible via theRawResponseproperty of anyResponseobject:Raw=GamesResponse.RawResponse;Jobj=json.loads(raw);Built-in functionsConvert entire Odds collection to decimal, then back to American:OddsResponse=Client.GetOdds();OddsResponse.AsDecimal();OddsResponse.AsAmerican();Convert individual Odds object to decimal, then back to American:OddsResponse=Client.GetOdds();FirstOdd=OddsResponse.Odds[0];FirstOdd.AsDecimal();FirstOdd.AsAmerican();Example usageFlatten and output data using pandas:importpandasaspd;fromOddsJamClientimportOddsJamClient;Client=OddsJamClient(YOUR_API_KEY);Odds=Client.GetOdds().Odds;df=pd.DataFrame(Odds);#Lambda over rows to extract just the ID from the 'game' object in each rowdf['game']=df.apply(lambdarow:row['game']['id'],axis=1)#Get odds for Moneyline markets onlydf=df.loc[df['market_name']=='Moneyline']PyPiProd:https://pypi.org/project/oddsjam-apiTest:https://test.pypi.org/project/oddsjam-api-testORIGINAL CREDIT GOES TOhttps://github.com/cooperbrandon1