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()
client.login(session, "username", "password", "app_key")
client.request(session, accounts.GetAccountFunds.with_params())
client.request(session, accounts.GetAccountFunds.with_params(wallet="AUS"))
client.request(session, betting.ListCurrentOrders.with_params())
from betfair_parser.endpoints import endpoint
endpoint_cfg = endpoint("ITA")
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 is pushed to GitHub.
export RELEASE=x.x.x
git commit --allow-empty -m "Release $RELEASE"
git tag -a $RELEASE -m "Version $RELEASE"
git push --tags
git push