Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sarartur/oddsapi
Python wrapper around The Odds-Api
https://github.com/sarartur/oddsapi
api-client api-wrapper odds-api python python-wrapper sports
Last synced: 4 days ago
JSON representation
Python wrapper around The Odds-Api
- Host: GitHub
- URL: https://github.com/sarartur/oddsapi
- Owner: sarartur
- License: mit
- Created: 2020-06-19T06:05:28.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-07-20T15:16:43.000Z (over 1 year ago)
- Last Synced: 2024-09-16T08:49:02.678Z (2 months ago)
- Topics: api-client, api-wrapper, odds-api, python, python-wrapper, sports
- Language: Python
- Homepage:
- Size: 40 KB
- Stars: 10
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# The Odds-Api
### Installation
The package requires Python 3.7 or higher.
Install latest version from PyPI: `pip install oddsapi`
### Description
The Odds-API provides sports odds data for loads of sports from bookmakers around the world. Get your free API key [here](https://the-odds-api.com/).
### Usage
Please refer to [documentation](https://the-odds-api.com/liveapi/guides/v3/) for detailed instructions for The Odds-Api.To start using the wrapper import and initialize the `OddsApiClient` from the package.
``` python
from oddsapi import OddsApiClientclient = OddsApiClient(api_key='YOUR KEY')
response = client.retrieve_sports()
```
The response is a custom object that stores the data in nested namespaces and dictionary format.
```python
response.data[0]>>> Collection(active=True,
details='US College Football',
group='American Football',
has_outrights=False,
key='americanfootball_ncaaf',
title='NCAAF')#alternatively
response.json['data'][0]
>>> {'key': 'americanfootball_ncaaf',
'active': True,
'group': 'American Football',
'details': 'US College Football',
'title': 'NCAAF',
'has_outrights': False}response.rate_info
>>> {'requests_remaining': '479', 'requests_used': '21'}
```
The client can also be configured to work with `asyncio`.```python
from asyncio import gatherclient.aio = True
cors = [client.retrieve_odds(
sport_key=sport.key,
region='us',
mkt='spreads'
) for sport in response.data[:4]]
responses = client.loop.run_until_complete(gather(*cors))
```
Keep in mind that `rate_info` will not be recorded in order.
### Contact
Email me at [email protected] or open a new [Issue](https://github.com/sarartur/oddsapi/issues) on Github.