Skip to main content

Python wrapper for The Odds-Api

Project description

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.

Usage

Please refer to documentation for detailed instructions for The Odds-Api.

To start using the wrapper import and initialize the OddsApiClient from the package.

from oddsapi import OddsApiClient

client = 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.

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.

from asyncio import gather

client.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 sarartur.ruk@gmail.com or open a new Issue on Github.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oddsapi-1.2.4.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oddsapi-1.2.4-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file oddsapi-1.2.4.tar.gz.

File metadata

  • Download URL: oddsapi-1.2.4.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

File hashes

Hashes for oddsapi-1.2.4.tar.gz
Algorithm Hash digest
SHA256 7db3611e2e831e0a9c6147ce8769ddcbf65e5a499a3892369f075c58c28b3646
MD5 dcd11d71a9dbc4a92c2d75aa7fda641b
BLAKE2b-256 7b03290c1e4b179020639639a72a379a07f40b16a84d1f59b2f30e94468b5295

See more details on using hashes here.

File details

Details for the file oddsapi-1.2.4-py3-none-any.whl.

File metadata

  • Download URL: oddsapi-1.2.4-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

File hashes

Hashes for oddsapi-1.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d67f433a62665aafe80df40c94dd621fe6b54ce9be24fea43d85131bceb97ada
MD5 c2075e1f62bc631c9e8a6a95f0a005a1
BLAKE2b-256 8d9321d75d3bcbd46b3b8a3dc162b0b5819a29d23199cac5cc9263b40ff98028

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page