Official Python SDK for Odds-API.io - Real-time sports betting odds from 250+ bookmakers
Project description
Odds-API.io Python SDK
Official Python SDK for Odds-API.io - Real-time sports betting odds from 250+ bookmakers.
๐ Features
- โก Fast & Reliable - Built on requests and aiohttp for both sync and async workflows
- ๐ 20+ Sports - Basketball, football, tennis, baseball, and more
- ๐ 250+ 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:
- 5,000 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="pinnacle,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="pinnacle",
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:
- basic_usage.py - Getting started with the SDK
- async_example.py - Using the async client
- arbitrage_finder.py - Finding arbitrage opportunities
- value_bets.py - Identifying value bets
- odds_tracking.py - Tracking odds movements
๐ง 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 - 250+ bookmakers across 20+ sports
- โ 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
- 5,000 requests per hour (shared across all plans)
- No WebSocket access on free tier
๐ Requirements
- Python 3.8 or higher
requestslibrary (for sync client)aiohttplibrary (for async client)
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Links
- Website: odds-api.io
- Documentation: docs.odds-api.io
- API Key: Get your API key
- GitHub: github.com/odds-api-io/odds-api-python
- Issues: Report a bug
- PyPI: pypi.org/project/odds-api-io
๐ฌ Support
Need help? We're here for you:
- ๐ง Email: hello@odds-api.io
- ๐ Documentation: docs.odds-api.io
- ๐ Issues: GitHub Issues
- โฑ๏ธ Response Time: Usually within 24 hours
โก Quick Links
Built with โค๏ธ by the Odds-API.io team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file odds_api_io-1.0.0.tar.gz.
File metadata
- Download URL: odds_api_io-1.0.0.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e0adadb083e1464beee2769575a269501f71235bef29556d99865d7f4f356be
|
|
| MD5 |
ae5e0deff3d0e00fc734589c2b20e4f4
|
|
| BLAKE2b-256 |
ab60a86e1d4d94e1943c45f868e087a9616f0423a1bb1c5a5fb534b2271124b0
|
File details
Details for the file odds_api_io-1.0.0-py3-none-any.whl.
File metadata
- Download URL: odds_api_io-1.0.0-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b9c7879745d9e092419604b973394e8a224e86e61ee15c2bc80bd0c4854a607
|
|
| MD5 |
63ce6713d070bf93e4cc529f71208fcd
|
|
| BLAKE2b-256 |
c092bd62b0eaeffa7bc76cf38f67efefd87ad10377fe842231e27110132f7ed1
|