Official Python client for the ResultsZA lottery API: Lotto, Powerball, EuroMillions, UK49s and horse racing results, plus lottery webhook verification.
Project description
resultsza-sdk (Python)
Official Python client for the ResultsZA lottery API - Lotto, Powerball, EuroMillions, UK49s and horse racing results, number tools, result checkers, and lottery webhook verification. It builds the request, handles errors, and hands you back the parsed JSON.
Official ResultsZA SDK. Not affiliated with the South African National Lottery, UK 49's, or any national lottery or racing operator. Always verify results on the official operator's site before claiming a prize.
Install
pip install resultsza-sdk
Or from source while it's in development:
pip install -e "python/[dev]"
Quickstart
Get an API key at resultsza.co.za/generate_api_key, then:
import os
from resultsza import ResultsZA
client = ResultsZA(api_key=os.environ["RESULTSZA_API_KEY"])
client.get_lotto_results() # latest draw
client.get_lotto_results(date="2026-07-08") # a specific draw
client.get_hot_cold_numbers(product="Powerball")
client.generate_random_numbers(game="Lotto", lines=5)
client.check_balance() # free - no calls used
The API key is read from an argument or your own environment variable - it is never hardcoded. If a key ever appears in a URL or error, the client redacts it.
Supported endpoints
| Method | Endpoint |
|---|---|
get_daily_lotto_results(date=None) |
Daily Lotto |
get_lotto_results(date=None) |
Lotto |
get_lotto_plus_1_results(date=None) |
Lotto Plus 1 |
get_lotto_5_max_results(date=None) |
Lotto 5 Max |
get_sa_powerball_results(date=None) |
SA Powerball |
get_powerball_xtra_results(date=None) |
Powerball Xtra |
get_kenya_lotto_results(date=None, draw_type=None) |
Kenya Lotto (draw_type: daily/jackpot) |
get_nigeria_lotto_results(game=None, date=None) |
Nigeria (Premier Lotto) |
get_ghana_lotto_results(game=None, date=None) |
Ghana Lotto |
get_uk49s_results(game, date=None) |
UK 49's (game required) |
get_euromillions_results(date=None) |
EuroMillions |
get_irish_lotto_results(date=None) |
Irish Lotto |
get_us_powerball_results(date=None) |
US Powerball |
get_megamillions_results(date=None) |
US Mega Millions |
get_horse_racing_meetings(from_date=None, to_date=None) |
Race meetings (max 7-day span) |
get_horse_racing_results(date, venue) |
Full race card |
get_horse_racing_race(date, venue, race_no) |
Single-race runner table |
generate_random_numbers(game, lines=None) |
Random line generator |
text_to_lucky_numbers(game, text) |
Deterministic text to numbers |
get_hot_cold_numbers(product) |
Hot & cold numbers |
get_number_frequencies(product) |
Per-number frequencies |
get_number_pairs(product) |
Top number pairs |
check_played_numbers(game, date, played_numbers) |
Checker - up to 10 lines |
bulk_check_numbers(game, date, played_numbers) |
Bulk checker - up to 500 lines |
check_balance() |
Remaining calls & subscription status (free) |
See the full API docs for response shapes. Parameters that accept only specific values (game, product, venue, draw_type) are listed under Games and parameter values below.
Games and parameter values
Some parameters only accept specific values. Here they are in full.
South African games - used by the SA result endpoints, both checkers, and the generators:
Daily Lotto, Lotto, Lotto Plus 1, Lotto 5 Max, Powerball, Powerball Xtra
UK 49's - get_uk49s_results(game=...), required:
UK49s Brunchtime, UK49s Lunchtime, UK49s Drivetime, UK49s Teatime
Kenya draw type - get_kenya_lotto_results(draw_type=...):
daily (hourly draws) or jackpot (Wed/Sat). Omit for both.
Horse racing venues - get_horse_racing_results / get_horse_racing_race venue:
Greyville, Kenilworth, Fairview, Vaal
Ghana Lotto games - get_ghana_lotto_results(game=...), optional (omit to return every game drawn on that date):
Ghana Monday Special, Ghana Lucky Tuesday, Ghana Mid-Week, Ghana Fortune Thursday, Ghana Friday Bonanza, Ghana National Weekly, Ghana Sunday Aseda, Ghana VAG Lotto, Ghana Noon Rush, Ghana Daywa 5/39
Nigeria (Premier Lotto) games - get_nigeria_lotto_results(game=...), optional (omit to return every game drawn on that date; Nigeria draws 6 of these per day):
25 game names
PREMIER 06, PREMIER ASEDA, PREMIER BINGO, PREMIER BONANZA, PREMIER CLUB MASTER, PREMIER DIAMOND, PREMIER ENUGU, PREMIER FAIRCHANCE, PREMIER FORTUNE, PREMIER GOLD, PREMIER INTERNATIONAL, PREMIER JACKPOT, PREMIER KING, PREMIER LUCKY, PREMIER LUCKY G, PREMIER MARK II, PREMIER METRO, PREMIER MIDWEEK, PREMIER MSP, PREMIER NATIONAL, PREMIER PEOPLES, PREMIER ROYAL, PREMIER SUPER, PREMIER TOTA, PREMIER VAG
Number generator / text-to-lucky games - generate_random_numbers / text_to_lucky_numbers game:
the SA games above, the four UK 49's variants above, plus EuroMillions, Irish Lotto, US Powerball, Mega Millions, Kenya Lotto, Nigeria Lotto, Ghana Lotto.
Hot/cold, frequencies, pairs - product: the SA games are the primary set; UK49s, EuroMillions, Irish Lotto, US Powerball, Mega Millions, Kenya Lotto, Nigeria Lotto, and Ghana Lotto are also supported.
Dates are always YYYY-MM-DD.
Errors
Failures raise typed exceptions so you can handle them predictably:
from resultsza.exceptions import (
ResultsZAError, # base class
BadRequestError, # invalid parameters
AuthError, # missing/invalid key
RateLimitError, # rate limit / cooldown
SubscriptionExpiredError,
SubscriptionPendingError,
)
try:
client.get_lotto_results(date="not-a-date")
except BadRequestError as exc:
print(exc.status_code, exc.response)
Webhooks
ResultsZA can push results to your endpoint the moment they're published. Register your endpoint URL and get your signing secret in the subscriber portal under Push Settings (there is no webhook API) - this SDK helps you receive those deliveries safely.
from resultsza.webhook import verify_and_parse, SIGNATURE_HEADER
from resultsza.exceptions import InvalidSignatureError
# raw = the exact request BYTES (not re-serialized JSON)
# signature = request header "X-ResultsZA-Signature"
try:
event = verify_and_parse(raw, signature, secret)
except InvalidSignatureError:
... # reject: return 401
if event.is_test: # portal test sends (result.test)
...
event.game, event.data, event.dedupe_key()
Three rules a correct receiver must follow, all shown in examples/webhook_receiver_flask.py:
- Verify against the raw request bytes, not a re-serialized copy of the JSON.
- Return a 2xx within 10 seconds, then do slow work afterwards.
- Deduplicate - delivery is at-least-once and unordered (
event.dedupe_key()helps).
Endpoints must be HTTPS. See the webhook docs.
Rate limits
The Unlimited tier is capped at 60 requests/minute; exceeding it triggers a 5-minute cooldown. Other tiers are bounded by a monthly quota. Check your usage any time with client.check_balance() - it doesn't consume a call. See pricing for tiers.
Testing
The test suite mocks the HTTP layer, so it needs no API key and never calls the production API:
pip install -e "python/[dev]"
cd python && pytest
Links
- Get an API key: https://resultsza.co.za/generate_api_key
- Set up webhooks (portal Push Settings): https://resultsza.co.za/portal/login
- API docs: https://resultsza.co.za/api_docs
- Webhook docs: https://resultsza.co.za/webhook-docs
- Pricing & plans: https://resultsza.co.za
MIT licensed.
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 resultsza_sdk-0.1.2.tar.gz.
File metadata
- Download URL: resultsza_sdk-0.1.2.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63c4607ff0d51a8055ab68d3189afd80ede6a9d767c051a58b4f4dd9f982d33f
|
|
| MD5 |
b5d80cd7ad750ebc56dc9b3ee752292f
|
|
| BLAKE2b-256 |
906f675c7e0122468f6c953fc91ae1b48acaae5d1d35feea7cc540299fbb49a8
|
Provenance
The following attestation bundles were made for resultsza_sdk-0.1.2.tar.gz:
Publisher:
publish-python.yml on Stef1986/resultsza-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
resultsza_sdk-0.1.2.tar.gz -
Subject digest:
63c4607ff0d51a8055ab68d3189afd80ede6a9d767c051a58b4f4dd9f982d33f - Sigstore transparency entry: 2145730421
- Sigstore integration time:
-
Permalink:
Stef1986/resultsza-sdk@44192be878ee2fa5fd1dc0614099d65f44591ee1 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Stef1986
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@44192be878ee2fa5fd1dc0614099d65f44591ee1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file resultsza_sdk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: resultsza_sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59ee4f8b22a41e62fbc83dd0f41779bd4e4272bfa2e27c62e984883047af43fd
|
|
| MD5 |
4f8bd897afc1612d502a21b4c3a019e0
|
|
| BLAKE2b-256 |
efda1144b173bdb411497160890377ec2386991730dcf6458441dc75798c4625
|
Provenance
The following attestation bundles were made for resultsza_sdk-0.1.2-py3-none-any.whl:
Publisher:
publish-python.yml on Stef1986/resultsza-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
resultsza_sdk-0.1.2-py3-none-any.whl -
Subject digest:
59ee4f8b22a41e62fbc83dd0f41779bd4e4272bfa2e27c62e984883047af43fd - Sigstore transparency entry: 2145730441
- Sigstore integration time:
-
Permalink:
Stef1986/resultsza-sdk@44192be878ee2fa5fd1dc0614099d65f44591ee1 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Stef1986
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@44192be878ee2fa5fd1dc0614099d65f44591ee1 -
Trigger Event:
release
-
Statement type: