biathlonresults


Namebiathlonresults JSON
Version 0.1 PyPI version JSON
download
home_pageNone
SummaryPython API wrapper for biathlonresults.com
upload_time2024-12-25 18:11:29
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT License Copyright (c) 2019 Ilya Porotikov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords biathlon api sport ibu
VCS
bugtrack_url
requirements requests
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python API wrapper for biathlonresults.com

![example workflow](https://github.com/prtkv/biathlonresults/actions/workflows/python-package.yml/badge.svg)

## Installation

```bash
pip install biathlonresults
```

## Examples

### Get WC 2024/2025 stages and races:
```python
import biathlonresults
events = biathlonresults.events("2425", level=biathlonresults.consts.LevelType.BMW_IBU_WC)
for event in events:
    print(event["ShortDescription"], event["StartDate"][:10], "-", event["EndDate"][:10])
    for race in biathlonresults.competitions(event["EventId"]):
        print("   ", race["RaceId"], race["ShortDescription"], race["StartTime"])
# output:
# Kontiolahti 2024-11-27 - 2024-12-08
#     BT2425SWRLCP01MXSR Single Mixed Relay (W+M) 2024-11-30T12:15:00Z
#     BT2425SWRLCP01MXRL Mixed Relay (W+M) 2024-11-30T14:45:00Z
#     BT2425SWRLCP01SMRL Men 4x7.5km Relay 2024-12-01T12:45:00Z
#     BT2425SWRLCP01SWRL Women 4x6km Relay 2024-12-01T16:25:00Z
#     BT2425SWRLCP01SMSI Men 15km Short Individual 2024-12-03T15:20:00Z
#     BT2425SWRLCP01SWSI Women 12.5km Short Individual 2024-12-04T15:20:00Z
# ...
```

### Get race results:
```python
import biathlonresults
race_results = biathlonresults.results(race_id="BT2425SWRLCP01SWSI")
for result in race_results['Results']:
    print(result["Rank"], result["ShortName"], result["Nat"], result["Shootings"], result["TotalTime"] if result["Rank"] == "1" else result["Behind"])
# output:    
# 1 JEANMONNOT L. FRA 0+0+0+0 35:52.3
# 2 HALVARSSON E. SWE 0+1+0+0 +12.3
# 3 OEBERG E. SWE 0+1+1+1 +56.4
# ...
```

### Find athlete:
```python
import biathlonresults
athletes = biathlonresults.athletes(family_name='bo', given_name='jo')
for i in athletes['Athletes']:
    print(i['IBUId'], i['FamilyName'], i['GivenName'])
# output:
# BTNOR11605199301 BOE Johannes Thingnes
# BTNOR11806199901 BOTN Johan-Olav
```

### Get last races of athlete:
```python
import biathlonresults
res = biathlonresults.all_results('BTNOR11605199301')
for i in res['Results']:
    print(i["RaceId"], i['Comp'], i['Season'], i['Place'], i['Rank'])
# output:
# BT2425SWRLCP03SMMS MS 24/25 Annecy 3.
# BT2425SWRLCP03SMPU PU 24/25 Annecy 1.
# BT2425SWRLCP03SMSP SP 24/25 Annecy 2.
# ...
```

### Race analytics:
```python
import biathlonresults
race_course_analytics = biathlonresults.analytic_results("BT2425SWRLCP01SWMS", type_id=biathlonresults.consts.AnalysisType.TOTAL_COURSE_TIME)
for result in race_course_analytics["Results"]:
    print(result["Rank"], result["Name"], result["TotalTime"] if result["Rank"] == "1" else result["Behind"])
# output:
# 1 OEBERG Elvira 31:20.7
# 2 BRAISAZ-BOUCHET Justine +17.0
# 3 PREUSS Franziska +20.1
# ...
```

### World Cup Scores:
```python
import biathlonresults
cups = biathlonresults.cups("2425")
for cup in cups:
    if cup["Level"] == biathlonresults.consts.LevelType.BMW_IBU_WC:
        print(cup["CupId"], cup["Description"])
# output:
# BT2425SWRLCP__SWTS Women's World Cup Total Score
# BT2425SWRLCP__SWSP Women's World Cup Sprint Score
# BT2425SWRLCP__SWPU Women's World Cup Pursuit Score
# ...

total_score_women = biathlonresults.cup_results("BT2425SWRLCP__SWTS")
for row in total_score_women['Rows']:
    print(row["Rank"], row["IBUId"], row["Name"], row["Nat"], row["Score"])
# output:
# 1 BTGER21103199401 PREUSS Franziska GER 565
# 2 BTSWE22602199901 OEBERG Elvira SWE 371
# 3 BTFRA22810199801 JEANMONNOT Lou FRA 352
# ...
```

see more examples [here](examples)

## Donations
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/prtkv)

BTC: bc1qfwe3ysmcklnujhyqfkh7japzyunvpk46h2a8ps

ETH: 0xAc41D8DbD12d96936344806F2a42f83E0Ea4Aad1

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "biathlonresults",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "biathlon, api, sport, ibu",
    "author": null,
    "author_email": "Ilya Porotikov <ip.tspl@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/6d/9c/8bab1f40f1a6aa1ed5b9932f60ab165781333d5542ca77b212380a016dfd/biathlonresults-0.1.tar.gz",
    "platform": null,
    "description": "# Python API wrapper for biathlonresults.com\n\n![example workflow](https://github.com/prtkv/biathlonresults/actions/workflows/python-package.yml/badge.svg)\n\n## Installation\n\n```bash\npip install biathlonresults\n```\n\n## Examples\n\n### Get WC 2024/2025 stages and races:\n```python\nimport biathlonresults\nevents = biathlonresults.events(\"2425\", level=biathlonresults.consts.LevelType.BMW_IBU_WC)\nfor event in events:\n    print(event[\"ShortDescription\"], event[\"StartDate\"][:10], \"-\", event[\"EndDate\"][:10])\n    for race in biathlonresults.competitions(event[\"EventId\"]):\n        print(\"   \", race[\"RaceId\"], race[\"ShortDescription\"], race[\"StartTime\"])\n# output:\n# Kontiolahti 2024-11-27 - 2024-12-08\n#     BT2425SWRLCP01MXSR Single Mixed Relay (W+M) 2024-11-30T12:15:00Z\n#     BT2425SWRLCP01MXRL Mixed Relay (W+M) 2024-11-30T14:45:00Z\n#     BT2425SWRLCP01SMRL Men 4x7.5km Relay 2024-12-01T12:45:00Z\n#     BT2425SWRLCP01SWRL Women 4x6km Relay 2024-12-01T16:25:00Z\n#     BT2425SWRLCP01SMSI Men 15km Short Individual 2024-12-03T15:20:00Z\n#     BT2425SWRLCP01SWSI Women 12.5km Short Individual 2024-12-04T15:20:00Z\n# ...\n```\n\n### Get race results:\n```python\nimport biathlonresults\nrace_results = biathlonresults.results(race_id=\"BT2425SWRLCP01SWSI\")\nfor result in race_results['Results']:\n    print(result[\"Rank\"], result[\"ShortName\"], result[\"Nat\"], result[\"Shootings\"], result[\"TotalTime\"] if result[\"Rank\"] == \"1\" else result[\"Behind\"])\n# output:    \n# 1 JEANMONNOT L. FRA 0+0+0+0 35:52.3\n# 2 HALVARSSON E. SWE 0+1+0+0 +12.3\n# 3 OEBERG E. SWE 0+1+1+1 +56.4\n# ...\n```\n\n### Find athlete:\n```python\nimport biathlonresults\nathletes = biathlonresults.athletes(family_name='bo', given_name='jo')\nfor i in athletes['Athletes']:\n    print(i['IBUId'], i['FamilyName'], i['GivenName'])\n# output:\n# BTNOR11605199301 BOE Johannes Thingnes\n# BTNOR11806199901 BOTN Johan-Olav\n```\n\n### Get last races of athlete:\n```python\nimport biathlonresults\nres = biathlonresults.all_results('BTNOR11605199301')\nfor i in res['Results']:\n    print(i[\"RaceId\"], i['Comp'], i['Season'], i['Place'], i['Rank'])\n# output:\n# BT2425SWRLCP03SMMS MS 24/25 Annecy 3.\n# BT2425SWRLCP03SMPU PU 24/25 Annecy 1.\n# BT2425SWRLCP03SMSP SP 24/25 Annecy 2.\n# ...\n```\n\n### Race analytics:\n```python\nimport biathlonresults\nrace_course_analytics = biathlonresults.analytic_results(\"BT2425SWRLCP01SWMS\", type_id=biathlonresults.consts.AnalysisType.TOTAL_COURSE_TIME)\nfor result in race_course_analytics[\"Results\"]:\n    print(result[\"Rank\"], result[\"Name\"], result[\"TotalTime\"] if result[\"Rank\"] == \"1\" else result[\"Behind\"])\n# output:\n# 1 OEBERG Elvira 31:20.7\n# 2 BRAISAZ-BOUCHET Justine +17.0\n# 3 PREUSS Franziska +20.1\n# ...\n```\n\n### World Cup Scores:\n```python\nimport biathlonresults\ncups = biathlonresults.cups(\"2425\")\nfor cup in cups:\n    if cup[\"Level\"] == biathlonresults.consts.LevelType.BMW_IBU_WC:\n        print(cup[\"CupId\"], cup[\"Description\"])\n# output:\n# BT2425SWRLCP__SWTS Women's World Cup Total Score\n# BT2425SWRLCP__SWSP Women's World Cup Sprint Score\n# BT2425SWRLCP__SWPU Women's World Cup Pursuit Score\n# ...\n\ntotal_score_women = biathlonresults.cup_results(\"BT2425SWRLCP__SWTS\")\nfor row in total_score_women['Rows']:\n    print(row[\"Rank\"], row[\"IBUId\"], row[\"Name\"], row[\"Nat\"], row[\"Score\"])\n# output:\n# 1 BTGER21103199401 PREUSS Franziska GER 565\n# 2 BTSWE22602199901 OEBERG Elvira SWE 371\n# 3 BTFRA22810199801 JEANMONNOT Lou FRA 352\n# ...\n```\n\nsee more examples [here](examples)\n\n## Donations\n[![\"Buy Me A Coffee\"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/prtkv)\n\nBTC: bc1qfwe3ysmcklnujhyqfkh7japzyunvpk46h2a8ps\n\nETH: 0xAc41D8DbD12d96936344806F2a42f83E0Ea4Aad1\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2019 Ilya Porotikov  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Python API wrapper for biathlonresults.com",
    "version": "0.1",
    "project_urls": {
        "Homepage": "https://github.com/prtkv/biathlonresults"
    },
    "split_keywords": [
        "biathlon",
        " api",
        " sport",
        " ibu"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "51070756ceff629d51254c8fbd7bf5b30c79e57e65ed2200d7534b4b1d083f40",
                "md5": "42a99227c487349d4fda869052908de7",
                "sha256": "8bea75be6b14f8b2fac34cf75f81a576319372b8993337c141fcbde2891a5dfc"
            },
            "downloads": -1,
            "filename": "biathlonresults-0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "42a99227c487349d4fda869052908de7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6375,
            "upload_time": "2024-12-25T18:11:27",
            "upload_time_iso_8601": "2024-12-25T18:11:27.629467Z",
            "url": "https://files.pythonhosted.org/packages/51/07/0756ceff629d51254c8fbd7bf5b30c79e57e65ed2200d7534b4b1d083f40/biathlonresults-0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6d9c8bab1f40f1a6aa1ed5b9932f60ab165781333d5542ca77b212380a016dfd",
                "md5": "f66e0986a0a10ebc44fe5d0e431f05fa",
                "sha256": "ac523988898de1bf3913d5cd3dc79186b848a489acaf4b1f9272331e428c890a"
            },
            "downloads": -1,
            "filename": "biathlonresults-0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f66e0986a0a10ebc44fe5d0e431f05fa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5863,
            "upload_time": "2024-12-25T18:11:29",
            "upload_time_iso_8601": "2024-12-25T18:11:29.775058Z",
            "url": "https://files.pythonhosted.org/packages/6d/9c/8bab1f40f1a6aa1ed5b9932f60ab165781333d5542ca77b212380a016dfd/biathlonresults-0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-25 18:11:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "prtkv",
    "github_project": "biathlonresults",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.22.0"
                ]
            ]
        }
    ],
    "lcname": "biathlonresults"
}
        
Elapsed time: 0.36552s