betfair_parser
A simple and fast betfair parser. Why you might like this library:
- Complete: All betfair (non-vendor) client API included
- Conventions: The API strictly follows pythonic naming conventions
- Consistency: All data is type checked, API requests as well as responses
- Comfort: All betfair enums and type definitions are included, to support IDE syntax completion
- Clear errors: API errors don't just throw cryptic codes, but contain documentation about that error
- Compatible: Use it with any HTTP library you like, including async libraries
- Cheetah fast: Thanks to the magic of msgspec, megabytes of input parse in milliseconds
Usage
betfair_parser is built out of API building blocks, that can be used with any HTTP client
you like. All API operations provide .headers(), .body() and a .parse_response() method.
The client module
contains a sample, minimalistic client implementation. It may be used as is with any requests-compatible
HTTP client or serve as an example, how to integrate betfair_parser with other HTTP clients.
import requests
from betfair_parser import client
from betfair_parser.spec import accounts, betting
session = requests.Session() # or anything similar like httpx.Client()
client.login(session, "username", "password", "app_key")
client.request(session, accounts.GetAccountFunds.with_params())
# AccountFundsResponse(available_to_bet_balance=10000.0, exposure=0.0,
# retained_commission=0.0, exposure_limit=-10000.0, discount_rate=0.0,
# points_balance=10, wallet=<Wallet.UK: 'UK'>)
# Request with an invalid wallet parameter:
client.request(session, accounts.GetAccountFunds.with_params(wallet="AUS"))
# >>> AccountAPINGException: INVALID_PARAMETERS: Problem parsing the parameters,
# or a mandatory parameter was not found
client.request(session, betting.ListCurrentOrders.with_params())
# CurrentOrderSummaryReport(current_orders=[], more_available=False)
# Support for other countries
from betfair_parser.endpoints import endpoint
endpoint_cfg = endpoint("ITA") # alpha-3 code
client.login(session, "username", "password", "app_key", endpoints=endpoint_cfg)
See test_live.py
for more API call examples.
Releasing
Releases are published automatically when a tag matching the version schema MAJOR.MINOR[.PATCH]
(e.g. 1.2.3 or 1.2) is pushed to GitHub. Tags that do not match this schema are ignored.
# Set next version number
export RELEASE=x.x.x
# Create tags
git commit --allow-empty -m "Release $RELEASE"
git tag -a $RELEASE -m "Version $RELEASE"
# Push
git push --tags
git push
Metadata
Release files for betfair-parser 0.21.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| betfair_parser-0.21.2.tar.gz | 12.5 MB | Without provenance | Details for betfair_parser-0.21.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| betfair_parser-0.21.2-py3-none-any.whl | Python 3 | none | any | Details for betfair_parser-0.21.2-py3-none-any.whl |
Total release size: 12.6 MB
Release files / betfair_parser-0.21.2.tar.gz
| Download URL | betfair_parser-0.21.2.tar.gz |
|---|---|
| Size | 12.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37654b26af985d5c47e8e53609fb80212b6c52d2b675bc5b539f9813e9f13338
|
|
BLAKE2b-256 checksum How to use checksums |
eb19878c8f3b59e7d150d55d658215aefcef6e90d5556412577e05989a468d32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / betfair_parser-0.21.2-py3-none-any.whl
| Download URL | betfair_parser-0.21.2-py3-none-any.whl |
|---|---|
| Size | 76.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
abb98f9d61407bc3073973b03d85ccbbf9a7bcb0e5f6afa91881011227efd483
|
|
BLAKE2b-256 checksum How to use checksums |
fb4e0b5fb2d3de873885df15f2d406e29ea43886a1f7b69e983226d37db6cf84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for betfair-parser 0.21.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.