betfair-parser


Namebetfair-parser JSON
Version 0.12.0 PyPI version JSON
download
home_pageNone
SummaryA betfair parser
upload_time2024-05-08 04:44:55
maintainerNone
docs_urlNone
authorBradley McElroy
requires_python<4.0,>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![betfair_parser logo](https://github.com/limx0/betfair_parser/assets/2386612/10d602a6-627c-48f1-8145-2f14232a8320)

[![GitHub Build Status](https://img.shields.io/github/actions/workflow/status/limx0/betfair_parser/build.yml?branch=main&logo=github)](https://github.com/limx0/betfair_parser/actions)
[![PyPI](https://img.shields.io/pypi/v/betfair_parser.svg?style=flat)](https://pypi.org/project/betfair_parser/)
![Python Version](https://img.shields.io/pypi/pyversions/betfair_parser)
![License](https://img.shields.io/github/license/limx0/betfair_parser)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

# 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](https://github.com/jcrist/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`](https://github.com/limx0/betfair_parser/blob/main/betfair_parser/client.py) 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.

```python
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`](https://github.com/limx0/betfair_parser/blob/main/tests/integration/test_live.py)
for more API call examples.


## Releasing

Releases are published automatically when a tag is pushed to GitHub.

```bash
# 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
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "betfair-parser",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Bradley McElroy",
    "author_email": "bradley.mcelroy@live.com",
    "download_url": "https://files.pythonhosted.org/packages/bd/0f/9cf16f794fbefdcda0c0454243925f8370bc4cc6758d56d12605e2b5c0fe/betfair_parser-0.12.0.tar.gz",
    "platform": null,
    "description": "![betfair_parser logo](https://github.com/limx0/betfair_parser/assets/2386612/10d602a6-627c-48f1-8145-2f14232a8320)\n\n[![GitHub Build Status](https://img.shields.io/github/actions/workflow/status/limx0/betfair_parser/build.yml?branch=main&logo=github)](https://github.com/limx0/betfair_parser/actions)\n[![PyPI](https://img.shields.io/pypi/v/betfair_parser.svg?style=flat)](https://pypi.org/project/betfair_parser/)\n![Python Version](https://img.shields.io/pypi/pyversions/betfair_parser)\n![License](https://img.shields.io/github/license/limx0/betfair_parser)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n# betfair_parser\n\nA simple and fast betfair parser. Why you might like this library:\n\n- Complete: All betfair (non-vendor) client API included\n- Conventions: The API strictly follows pythonic naming conventions\n- Consistency: All data is type checked, API requests as well as responses\n- Comfort: All betfair enums and type definitions are included, to support IDE syntax completion\n- Clear errors: API errors don't just throw cryptic codes, but contain documentation about that error\n- Compatible: Use it with any HTTP library you like, including async libraries\n- Cheetah fast: Thanks to the magic of [msgspec](https://github.com/jcrist/msgspec), megabytes of input\nparse in milliseconds\n\n\n## Usage\n\n`betfair_parser` is built out of API building blocks, that can be used with any HTTP client\nyou like. All API operations provide `.headers()`, `.body()` and a `.parse_response()` method.\n\nThe [`client`](https://github.com/limx0/betfair_parser/blob/main/betfair_parser/client.py) module\ncontains a sample, minimalistic client implementation. It may be used as is with any `requests`-compatible\nHTTP client or serve as an example, how to integrate `betfair_parser` with other HTTP clients.\n\n```python\nimport requests\nfrom betfair_parser import client\nfrom betfair_parser.spec import accounts, betting\n\nsession = requests.Session()  # or anything similar like httpx.Client()\nclient.login(session, \"username\", \"password\", \"app_key\")\nclient.request(session, accounts.GetAccountFunds.with_params())\n# AccountFundsResponse(available_to_bet_balance=10000.0, exposure=0.0,\n# retained_commission=0.0, exposure_limit=-10000.0, discount_rate=0.0,\n# points_balance=10, wallet=<Wallet.UK: 'UK'>)\n\n# Request with an invalid wallet parameter:\nclient.request(session, accounts.GetAccountFunds.with_params(wallet=\"AUS\"))\n# >>> AccountAPINGException: INVALID_PARAMETERS: Problem parsing the parameters,\n#     or a mandatory parameter was not found\n\nclient.request(session, betting.ListCurrentOrders.with_params())\n# CurrentOrderSummaryReport(current_orders=[], more_available=False)\n\n# Support for other countries\nfrom betfair_parser.endpoints import endpoint\nendpoint_cfg = endpoint(\"ITA\")  # alpha-3 code\nclient.login(session, \"username\", \"password\", \"app_key\", endpoints=endpoint_cfg)\n```\n\nSee [`test_live.py`](https://github.com/limx0/betfair_parser/blob/main/tests/integration/test_live.py)\nfor more API call examples.\n\n\n## Releasing\n\nReleases are published automatically when a tag is pushed to GitHub.\n\n```bash\n# Set next version number\nexport RELEASE=x.x.x\n\n# Create tags\ngit commit --allow-empty -m \"Release $RELEASE\"\ngit tag -a $RELEASE -m \"Version $RELEASE\"\n\n# Push\ngit push --tags\ngit push\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A betfair parser",
    "version": "0.12.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6df256072672b08c7d51d65d03142233a04a895ba8a162ba3abfc5f1f6b74b51",
                "md5": "58ab8e175a0ec7905997f8024c337cc2",
                "sha256": "a2cf327647beb95dc40ee770c411ed91c67bdfb3ae7ed1714f1096375c2b055c"
            },
            "downloads": -1,
            "filename": "betfair_parser-0.12.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "58ab8e175a0ec7905997f8024c337cc2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 65334,
            "upload_time": "2024-05-08T04:44:54",
            "upload_time_iso_8601": "2024-05-08T04:44:54.149006Z",
            "url": "https://files.pythonhosted.org/packages/6d/f2/56072672b08c7d51d65d03142233a04a895ba8a162ba3abfc5f1f6b74b51/betfair_parser-0.12.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bd0f9cf16f794fbefdcda0c0454243925f8370bc4cc6758d56d12605e2b5c0fe",
                "md5": "09cf1bc1ba6690b903dbacee873fbe86",
                "sha256": "452680e8d670a114745f298543b53ffd92e7b3fb71255454dc14c6ca980d7362"
            },
            "downloads": -1,
            "filename": "betfair_parser-0.12.0.tar.gz",
            "has_sig": false,
            "md5_digest": "09cf1bc1ba6690b903dbacee873fbe86",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 54902,
            "upload_time": "2024-05-08T04:44:55",
            "upload_time_iso_8601": "2024-05-08T04:44:55.713803Z",
            "url": "https://files.pythonhosted.org/packages/bd/0f/9cf16f794fbefdcda0c0454243925f8370bc4cc6758d56d12605e2b5c0fe/betfair_parser-0.12.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-08 04:44:55",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "betfair-parser"
}
        
Elapsed time: 0.28303s