Official Python SDK for the PuntersEdge Australian Sports Odds API
Project description
PuntersEdge Python SDK
Official Python client for the PuntersEdge Australian Sports Odds API.
PuntersEdge gives developers simple REST access to Australian sports odds, best-price comparisons, next-to-go racing and arbitrage signals from local bookmakers.
Install
pip install puntersedge
For local development from this repository:
pip install -e sdk/python
Quick start
from puntersedge import PuntersEdgeClient
client = PuntersEdgeClient("YOUR_API_KEY")
sports = client.get_sports()
odds = client.get_odds("nrl", markets=["h2h"])
print(odds[:1])
client.close()
Authentication
Pass your API key when creating the client. The SDK sends it as the X-API-Key header.
client = PuntersEdgeClient(api_key="YOUR_API_KEY")
You can override the API base URL for testing:
client = PuntersEdgeClient("YOUR_API_KEY", base_url="http://localhost:8010")
Methods
| Method | Description | Returns | Endpoint |
|---|---|---|---|
get_sports() |
List active sports and competitions | list |
GET /v1/sports |
get_odds(sport_key, markets=None, bookmakers=None) |
Get bookmaker odds for a sport. Defaults to h2h market. |
list |
GET /v1/sports/{sport_key}/odds |
get_best_odds(sport_key) |
Get best available prices by outcome for a sport | list |
GET /v1/best-odds/{sport_key} |
get_racing(categories=None, num_races=10) |
Get next-to-go racing markets | list |
GET /v1/racing/next-to-go |
get_arb(sport_key=None, min_profit_pct=0.5) |
Scan for arbitrage opportunities | dict |
GET /v1/arb/sports |
get_usage() |
View plan, credits, endpoint usage and recent activity | dict |
GET /v1/usage |
get_health() |
Connector health and freshness | dict |
GET /v1/health |
close() |
Close the underlying HTTP connection pool | None |
- |
Async usage
import asyncio
from puntersedge import AsyncPuntersEdgeClient
async def main():
async with AsyncPuntersEdgeClient("YOUR_API_KEY") as client:
sports = await client.get_sports()
odds = await client.get_odds("afl", markets=["h2h"])
usage = await client.get_usage()
print(len(sports), len(odds), usage["credits_remaining"])
asyncio.run(main())
Error handling
from puntersedge import PuntersEdgeClient
from puntersedge.exceptions import AuthError, RateLimitError, NotFoundError, ServerError
client = PuntersEdgeClient("YOUR_API_KEY")
try:
print(client.get_odds("nrl"))
except AuthError:
print("Invalid API key")
except RateLimitError as exc:
print(f"Credit limit reached. Resets at {exc.reset_at}")
except NotFoundError:
print("Unknown sport or endpoint")
except ServerError:
print("PuntersEdge API is temporarily unavailable")
finally:
client.close()
All SDK exceptions inherit from PuntersEdgeError.
Examples
See the examples/ directory:
basic_usage.py— list sports, fetch NRL odds and check usagearb_scanner.py— scan all sports for arbitrage opportunitiesracing_ntg.py— print next-to-go racing runners and prices
Run an example with:
PUNTERSEDGE_API_KEY=YOUR_API_KEY python sdk/python/examples/basic_usage.py
Documentation
- API docs: https://puntersedge.online/api/docs
- Developer docs: https://puntersedge.online/developers
- Website: https://puntersedge.online
18+ only. Please gamble responsibly.
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 puntersedge-0.1.0.tar.gz.
File metadata
- Download URL: puntersedge-0.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e3b634a8da07302af081c528853c511f1d7e6e249682b2da8dd62e41bf31bb2
|
|
| MD5 |
e341255d3a07b8bf92a341ca2c1e5a08
|
|
| BLAKE2b-256 |
9f831063cb7c9d6b60b1ce2bde0e1894c7d80c54700e08a6170f128c864b1696
|
File details
Details for the file puntersedge-0.1.0-py3-none-any.whl.
File metadata
- Download URL: puntersedge-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f85507abc01f7c240866c5f8ab51519ceaa76692ed09da5584209a601e94710
|
|
| MD5 |
475fe5a19b9c5d87d0c38e782dfd015b
|
|
| BLAKE2b-256 |
cd5bc018c6ff5483116f4ed5bda4ce0b3f411f05272d620380de6b9ba1d92099
|