Skip to main content

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 usage
  • arb_scanner.py — scan all sports for arbitrage opportunities
  • racing_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

18+ only. Please gamble responsibly.

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

puntersedge-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

puntersedge-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

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

Hashes for puntersedge-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4e3b634a8da07302af081c528853c511f1d7e6e249682b2da8dd62e41bf31bb2
MD5 e341255d3a07b8bf92a341ca2c1e5a08
BLAKE2b-256 9f831063cb7c9d6b60b1ce2bde0e1894c7d80c54700e08a6170f128c864b1696

See more details on using hashes here.

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

Hashes for puntersedge-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f85507abc01f7c240866c5f8ab51519ceaa76692ed09da5584209a601e94710
MD5 475fe5a19b9c5d87d0c38e782dfd015b
BLAKE2b-256 cd5bc018c6ff5483116f4ed5bda4ce0b3f411f05272d620380de6b9ba1d92099

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