Skip to main content

betfair_parser logo

GitHub Build Status PyPI Python Version License Ruff

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for betfair-parser 0.21.0
File Size Uploaded
betfair_parser-0.21.0.tar.gz 12.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for betfair-parser 0.21.0
File Interpreter ABI Platform
betfair_parser-0.21.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 MB

Release files / betfair_parser-0.21.0.tar.gz

Download URL betfair_parser-0.21.0.tar.gz
Size 12.3 MB
Tags Source
SHA-256 checksum
How to use checksums
f249e34e92186f9d3567ad19a516af5fb6549e40fee6f381d1ad02717ff36a06
BLAKE2b-256 checksum
How to use checksums
03ea8e0379477a46bb569ae5c6259848acd0819907d3ca33fdcabe2c33754b11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / betfair_parser-0.21.0-py3-none-any.whl

Download URL betfair_parser-0.21.0-py3-none-any.whl
Size 75.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be5ad0727fa7cbc4fe7ad21e8a4b126dc412beb93879c7ef86757ac30f8698e0
BLAKE2b-256 checksum
How to use checksums
d7934337d2ed1c78049bb985537a7901c790c5da8eb46018e8b5c39dd9cd7e31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.21.0 This release

2 release files

0.20.0

2 release files

0.19.2

2 release files

0.19.1

2 release files

0.19

2 release files

0.18.0

2 release files

0.17.2

2 release files

0.17

2 release files

0.16.2

2 release files

0.16.1

2 release files

0.16.0

2 release files

0.14.5

2 release files

0.14.4

2 release files

0.14.3

2 release files

0.14.2

2 release files

0.14.1

2 release files

0.13.0

2 release files

0.12.1

2 release files

0.11.2

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.6

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.21

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page