Skip to main content

Official Python SDK for Odds-API.io - Real-time sports betting odds from 265+ bookmakers

Project description

Odds-API.io Python SDK

PyPI version Python versions License: MIT Documentation

Official Python SDK for Odds-API.io - Real-time sports betting odds from 265+ bookmakers.

Building with AI? See the AI and vibe coding guide. Prefer JavaScript? Check out the Node.js SDK.

๐Ÿš€ Features

  • โšก Fast & Reliable - Built on requests and aiohttp for both sync and async workflows
  • ๐Ÿ€ 34 Sports - Basketball, football, tennis, baseball, and more
  • ๐Ÿ“Š 265+ Bookmakers - Comprehensive odds coverage from major sportsbooks worldwide
  • ๐Ÿ’ฐ Arbitrage Detection - Find risk-free betting opportunities across bookmakers
  • ๐Ÿ“ˆ Value Bets - Identify positive expected value betting opportunities
  • ๐Ÿ”ด Live Events - Real-time in-play event tracking and odds
  • ๐Ÿ” Advanced Search - Search events, participants, and leagues
  • โœจ Type Hints - Full type annotations for better IDE support
  • ๐Ÿ Modern Python - Supports Python 3.8+

๐Ÿ“ฆ Installation

pip install odds-api-io

๐Ÿ”‘ Get Your API Key

Get your free API key here โ†’

Sign up at odds-api.io to get started. Free tier includes:

  • 100 requests/hour
  • Access to all endpoints
  • No credit card required

๐Ÿ“š Documentation

Full API documentation is available at docs.odds-api.io

๐Ÿƒ Quick Start

Synchronous Client

from odds_api import OddsAPIClient

# Initialize the client
client = OddsAPIClient(api_key="your_api_key_here")

# Get available sports
sports = client.get_sports()
print(f"Found {len(sports)} sports")

# Get upcoming NBA events
events = client.get_events(sport="basketball", league="usa-nba")

# Search for specific games
lakers_games = client.search_events(query="Lakers")

# Get live basketball events
live = client.get_live_events(sport="basketball")

# Find arbitrage opportunities
arb_bets = client.get_arbitrage_bets(
    bookmakers="singbet,bet365",
    limit=10,
    include_event_details=True
)

# Close the client when done
client.close()

Asynchronous Client

import asyncio
from odds_api import AsyncOddsAPIClient

async def main():
    # Use async context manager
    async with AsyncOddsAPIClient(api_key="your_api_key_here") as client:
        # Get sports
        sports = await client.get_sports()
        
        # Get upcoming events
        events = await client.get_events(sport="basketball", league="usa-nba")
        
        # Find value bets
        value_bets = await client.get_value_bets(
            bookmaker="singbet",
            include_event_details=True
        )
        
        print(f"Found {len(value_bets)} value betting opportunities")

# Run async code
asyncio.run(main())

Context Manager (Recommended)

# Sync
with OddsAPIClient(api_key="your_api_key") as client:
    sports = client.get_sports()

# Async
async with AsyncOddsAPIClient(api_key="your_api_key") as client:
    sports = await client.get_sports()

๐Ÿ“– Examples

Check out the examples/ directory for more detailed examples:

๐Ÿ”ง API Reference

Sports & Leagues

Method Description Docs
get_sports() Get all available sports ๐Ÿ“–
get_leagues(sport) Get leagues for a sport ๐Ÿ“–

Events

Method Description Docs
get_events(sport, **filters) Get events with filters ๐Ÿ“–
get_event_by_id(event_id) Get specific event details ๐Ÿ“–
get_live_events(sport) Get currently live events ๐Ÿ“–
search_events(query) Search events by keyword ๐Ÿ“–

Odds

Method Description Docs
get_event_odds(event_id, bookmakers) Get odds for an event ๐Ÿ“–
get_odds_movement(event_id, bookmaker, market) Track odds changes ๐Ÿ“–
get_odds_for_multiple_events(event_ids, bookmakers) Get odds for multiple events ๐Ÿ“–
get_updated_odds_since_timestamp(since, bookmaker, sport) Get recently updated odds ๐Ÿ“–

Participants

Method Description Docs
get_participants(sport, search=None) Get teams/players ๐Ÿ“–
get_participant_by_id(participant_id) Get participant by ID ๐Ÿ“–

Bookmakers

Method Description Docs
get_bookmakers() Get all available bookmakers ๐Ÿ“–
get_selected_bookmakers() Get your selected bookmakers ๐Ÿ“–
select_bookmakers(bookmakers) Select bookmakers ๐Ÿ“–
clear_selected_bookmakers() Clear selection ๐Ÿ“–

Betting Analysis

Method Description Docs
get_arbitrage_bets(bookmakers, **options) Find arbitrage opportunities ๐Ÿ“–
get_value_bets(bookmaker, **options) Find value bets ๐Ÿ“–

โš ๏ธ Error Handling

The SDK provides custom exceptions for different error scenarios:

from odds_api import (
    OddsAPIClient,
    OddsAPIError,
    InvalidAPIKeyError,
    RateLimitExceededError,
    NotFoundError,
    ValidationError
)

client = OddsAPIClient(api_key="your_api_key")

try:
    events = client.get_events(sport="basketball")
except InvalidAPIKeyError:
    print("Your API key is invalid")
except RateLimitExceededError:
    print("Rate limit exceeded - wait before retrying")
except NotFoundError:
    print("Resource not found")
except ValidationError as e:
    print(f"Invalid parameters: {e}")
except OddsAPIError as e:
    print(f"API error: {e}")

๐ŸŒŸ Why Odds-API.io?

  • โœ… Most Comprehensive Coverage - 265+ bookmakers across 34 sports and 12,000+ leagues
  • โœ… Near-Zero Latency - Real-time odds updates with minimal delay
  • โœ… Direct Bet Links - Deep links directly to bookmaker bet slips
  • โœ… Value Bet Detection - Automatically calculated expected value
  • โœ… Historical Data - Access to past odds and results
  • โœ… Developer Friendly - Clean API design with excellent documentation

๐Ÿ’ก Use Cases

Build powerful betting tools and analytics:

  • ๐ŸŽฏ Arbitrage betting platforms
  • ๐Ÿ“Š Odds comparison sites
  • ๐Ÿ“ˆ Value betting calculators
  • ๐Ÿค– Automated betting systems
  • ๐Ÿ“‰ Sports analytics dashboards
  • ๐Ÿ”” Odds movement alerts

๐Ÿ†“ Free Tier Limitations

  • Limited to 2 bookmakers selected at once
  • 100 requests per hour
  • No WebSocket access on free tier

Upgrade for more features โ†’

๐Ÿ“‹ Requirements

  • Python 3.8 or higher
  • requests library (for sync client)
  • aiohttp library (for async client)

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ”— Links

๐Ÿ’ฌ Support

Need help? We're here for you:

โšก Quick Links


Built with โค๏ธ by the Odds-API.io team

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

odds_api_io-1.0.2.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

odds_api_io-1.0.2-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file odds_api_io-1.0.2.tar.gz.

File metadata

  • Download URL: odds_api_io-1.0.2.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for odds_api_io-1.0.2.tar.gz
Algorithm Hash digest
SHA256 bb8e73c1daa1c11930c38a62f01d9f63e4a0dad6ea2d8dfdeb66dfde11dcf3d7
MD5 7520c119190c403aee1cc4d0c2b67df6
BLAKE2b-256 1cb0f1ecb0b29d681a18e808ff50c78c91e7e2b81101ae1ac3f6dffcf977526f

See more details on using hashes here.

File details

Details for the file odds_api_io-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: odds_api_io-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for odds_api_io-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c56edef0f7eb5148cec2d06f721120001073fe7d8e4569e31f50d9be9475c9b3
MD5 139f0b570d54901cb4798dc100f45168
BLAKE2b-256 cb9964339ae65188f71252e770962637d881b182ef58732692724a08485828f5

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