# Livescore-api
<p align="center">
<a href="https://github.com/Simatwa/livescore-api/actions/workflows/python-test.yml"><img src="https://github.com/Simatwa/livescore-api/actions/workflows/python-test.yml/badge.svg" alt="Python Test"/></a>
<a href="LICENSE"><img alt="License" src="https://img.shields.io/static/v1?logo=GPL&color=Blue&message=MIT&label=License"/></a>
<a href="https://pypi.org/project/livescore-api"><img alt="PyPi" src="https://img.shields.io/static/v1?logo=pypi&label=Pypi&message=v0.0.4&color=green"/></a>
<a href="https://github.com/psf/black"><img alt="Black" src="https://img.shields.io/static/v1?logo=Black&label=Code-style&message=Black"/></a>
<a href="#"><img alt="Passing" src="https://img.shields.io/static/v1?logo=Docs&label=Docs&message=Passing&color=green"/></a>
<a href="#"><img alt="coverage" src="https://img.shields.io/static/v1?logo=Coverage&label=Coverage&message=60%&color=yellowgreen"/></a>
<a href="#" alt="progress"><img alt="Progress" src="https://img.shields.io/static/v1?logo=Progress&label=Progress&message=95%&color=green"/></a>
<a href="https://pepy.tech/project/livescore-api"><img src="https://static.pepy.tech/personalized-badge/livescore-api?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads" alt="Downloads"></a>
</p>
**Access and manipulate football data from [Livescore](https://livescore.com).**
## Installation
1. From pip
```sh
pip install livescore-api
```
2. From source
- Clone repo and install
```sh
git clone https://github.com/Simatwa/livescore-api.git
cd livescore-api
pip install .
```
## Usage
- `$ livescore-api`
<details>
<summary>
### Developer docs
</summary>
1. Retrieving data offline
```py
from livescore_api import json_formatter
raw_matches = open("matches.json").read()
sorted_matches = json_formatter(raw_matches)
print(sorted_matches(max=1))
"""
Output
[
{
"Serial Id": "12413",
"League": "Primera Division",
"Country": "Argentina",
"Match Id": "866073",
"H Scores": "1",
"A Scores": "4",
"Kickoff": 20230613011500,
"Status": "FT",
"Home": "Banfield",
"H id": "5252",
"Away": "River Plate",
"A id": "4802"
}
]
"""
```
2. Retrieving data online
```py
from livescore_api import livescore
matches = livescore()
print(matches(max=1))
"""
Output
[
{
"Serial Id": "12413",
"League": "Primera Division",
"Country": "Argentina",
"Match Id": "866073",
"H Scores": "1",
"A Scores": "4",
"Kickoff": 20230613011500,
"Status": "FT",
"Home": "Banfield",
"H id": "5252",
"Away": "River Plate",
"A id": "4802"
}
]
"""
```
3. Making predictions
```py
from livescore_api import Make
matches = [{"Home":"Arsenal", "Away":"Liverpool"}]
bet = Make(matches)
print(bet())
"""
Output
[{'Home': 'Arsenal', 'Away': 'Liverpool', 'g': 10.0, 'gg': 55.0, 'ov15': 60.0, 'ov25': 45.0, 'ov35': 25.0, 'choice': 62.5, 'result': '2', 'pick': '2'}]
"""
```
</details>
</summary>
<details>
<summary>
For more info run `$ livescore-api -h`
</summary>
```
usage: livescore-api [-h] [-v] [-m MONTH] [-y YEAR] [-c COUNTRY]
[-l LEAGUE] [-n NAME] [-s STATUS] [-M MAX]
[-H HEADERS] [-o PATH]
[-f html|csv|xlsx|markdown|xml|json] [-i PATH]
[-t html|pretty|grid|fancy_grid|orgtbl|secure_html]
[-D CODE] [-E TIMEOUT] [-I INDENT] [-C PATH]
[--update] [--raw] [--predict] [-U USERNAME]
[-P PASSWORD] [-S SERVER] [-T LIMIT] [--offline]
[--REST] [--include-position]
[date]
Access and manipulate matches from Livescore.com
positional arguments:
date Date of the matches - 13
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-m MONTH, --month MONTH
Month of the matches - 6
-y YEAR, --year YEAR Year of the matches - 2023
-c COUNTRY, --country COUNTRY
Return matches from the specified countries only
- None
-l LEAGUE, --league LEAGUE
Return matches of the specified league(s) only -
None
-n NAME, --name NAME Return matches with the specified team-name only
- None
-s STATUS, --status STATUS
Return matches of the specified status - None
-M MAX, --max MAX Maximum matches to be returned - 1000
-H HEADERS, --headers HEADERS
Path to .json file containing http headers - None
-o PATH, --output PATH
Path to save the content - None
-f html|csv|xlsx|markdown|xml|json, --format html|csv|xlsx|markdown|xml|json
Contents output format - json
-i PATH, --input PATH
Use .json formatted file in path - None
-t html|pretty|grid|fancy_grid|orgtbl|secure_html, --tabulate html|pretty|grid|fancy_grid|orgtbl|secure_html
Tabulate the contents using style specified -
None
-D CODE, --code CODE Country code for making http request - KE
-E TIMEOUT, --timeout TIMEOUT
Http request timeout - 20s
-I INDENT, --indent INDENT
Indentation level for formatting .json output - 4
-C PATH, --config PATH
Use mapper-keys in path - None
--update Update mapper-keys from repo - False
--raw Return contents with zero manipulation - False
--predict Proceed to make predictions - False
-U USERNAME, --username USERNAME
Username for the REST api - API
-P PASSWORD, --password PASSWORD
Passkey for the REST api - developer
-S SERVER, --server SERVER
Url pointing to REST api - http://localhost:8000
-T LIMIT, --limit LIMIT
Limit number of matches for prediction - 1000
--offline Make predictions based on data available offline
- False
--REST Specifies to make predictions using REST api -
False
--include-position Include team-league rank in making predictions -
False
This script has no official relation with Livescore.com
```
</details>
## Disclaimer
This script utilizes the Livescore API to provide live scores and other information about sporting events. The Livescore-API is a third-party service and is not affiliated with any specific sporting event or organization. The accuracy of the information provided by the Livescore API is not guaranteed and may vary depending on a number of factors, including the availability of data and the quality of the data. The user of this script assumes all responsibility for any legal action, errors or omissions in the information provided by the Livescore API.
<details>
<summary>
Author
</summary>
The author of this script makes no representations or warranties, express or implied, about the accuracy, completeness, or suitability of the information provided by the Livescore API. The author of this script accepts no liability for any legal action, errors or omissions in the information provided by the Livescore API.
**Note** : This is just for information purposes do not sue me.
</details>
Raw data
{
"_id": null,
"home_page": "https://github.com/Simatwa/livescore-api",
"name": "livescore-api",
"maintainer": "Smartwa",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "livescore, football, livescore-api, api",
"author": "Smartwa",
"author_email": "smartwacaleb@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ab/e4/41be072021113665e6a2c3e75d9000a3a11bd13994f56ba1b8d4a217f4bc/livescore-api-0.0.5.tar.gz",
"platform": null,
"description": "# Livescore-api\n<p align=\"center\">\n<a href=\"https://github.com/Simatwa/livescore-api/actions/workflows/python-test.yml\"><img src=\"https://github.com/Simatwa/livescore-api/actions/workflows/python-test.yml/badge.svg\" alt=\"Python Test\"/></a>\n<a href=\"LICENSE\"><img alt=\"License\" src=\"https://img.shields.io/static/v1?logo=GPL&color=Blue&message=MIT&label=License\"/></a>\n<a href=\"https://pypi.org/project/livescore-api\"><img alt=\"PyPi\" src=\"https://img.shields.io/static/v1?logo=pypi&label=Pypi&message=v0.0.4&color=green\"/></a>\n<a href=\"https://github.com/psf/black\"><img alt=\"Black\" src=\"https://img.shields.io/static/v1?logo=Black&label=Code-style&message=Black\"/></a>\n<a href=\"#\"><img alt=\"Passing\" src=\"https://img.shields.io/static/v1?logo=Docs&label=Docs&message=Passing&color=green\"/></a>\n<a href=\"#\"><img alt=\"coverage\" src=\"https://img.shields.io/static/v1?logo=Coverage&label=Coverage&message=60%&color=yellowgreen\"/></a>\n<a href=\"#\" alt=\"progress\"><img alt=\"Progress\" src=\"https://img.shields.io/static/v1?logo=Progress&label=Progress&message=95%&color=green\"/></a>\n<a href=\"https://pepy.tech/project/livescore-api\"><img src=\"https://static.pepy.tech/personalized-badge/livescore-api?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads\" alt=\"Downloads\"></a>\n</p>\n\n**Access and manipulate football data from [Livescore](https://livescore.com).**\n\n## Installation\n\n1. From pip\n\n```sh\npip install livescore-api\n```\n\n2. From source\n\n- Clone repo and install\n\n```sh\ngit clone https://github.com/Simatwa/livescore-api.git\ncd livescore-api\npip install .\n```\n\n## Usage\n\n- `$ livescore-api`\n\n<details>\n<summary>\n\n### Developer docs\n\n</summary>\n\n1. Retrieving data offline\n\n```py\nfrom livescore_api import json_formatter\nraw_matches = open(\"matches.json\").read()\nsorted_matches = json_formatter(raw_matches)\nprint(sorted_matches(max=1))\n\n\"\"\"\nOutput\n[\n{\n \"Serial Id\": \"12413\",\n \"League\": \"Primera Division\",\n \"Country\": \"Argentina\",\n \"Match Id\": \"866073\",\n \"H Scores\": \"1\",\n \"A Scores\": \"4\",\n \"Kickoff\": 20230613011500,\n \"Status\": \"FT\",\n \"Home\": \"Banfield\",\n \"H id\": \"5252\",\n \"Away\": \"River Plate\",\n \"A id\": \"4802\"\n}\n]\n\"\"\"\n```\n\n2. Retrieving data online\n\n```py\nfrom livescore_api import livescore\n\nmatches = livescore()\nprint(matches(max=1))\n\n\"\"\"\nOutput\n\n[\n{\n \"Serial Id\": \"12413\",\n \"League\": \"Primera Division\",\n \"Country\": \"Argentina\",\n \"Match Id\": \"866073\",\n \"H Scores\": \"1\",\n \"A Scores\": \"4\",\n \"Kickoff\": 20230613011500,\n \"Status\": \"FT\",\n \"Home\": \"Banfield\",\n \"H id\": \"5252\",\n \"Away\": \"River Plate\",\n \"A id\": \"4802\"\n}\n]\n\"\"\"\n```\n\n3. Making predictions\n\n```py\nfrom livescore_api import Make\nmatches = [{\"Home\":\"Arsenal\", \"Away\":\"Liverpool\"}]\nbet = Make(matches)\nprint(bet())\n\n\"\"\"\nOutput\n\n[{'Home': 'Arsenal', 'Away': 'Liverpool', 'g': 10.0, 'gg': 55.0, 'ov15': 60.0, 'ov25': 45.0, 'ov35': 25.0, 'choice': 62.5, 'result': '2', 'pick': '2'}]\n\"\"\"\n\n```\n</details>\n\n</summary>\n\n<details>\n\n<summary>\n\nFor more info run `$ livescore-api -h`\n\n</summary>\n\n```\nusage: livescore-api [-h] [-v] [-m MONTH] [-y YEAR] [-c COUNTRY]\n [-l LEAGUE] [-n NAME] [-s STATUS] [-M MAX]\n [-H HEADERS] [-o PATH]\n [-f html|csv|xlsx|markdown|xml|json] [-i PATH]\n [-t html|pretty|grid|fancy_grid|orgtbl|secure_html]\n [-D CODE] [-E TIMEOUT] [-I INDENT] [-C PATH]\n [--update] [--raw] [--predict] [-U USERNAME]\n [-P PASSWORD] [-S SERVER] [-T LIMIT] [--offline]\n [--REST] [--include-position]\n [date]\n\nAccess and manipulate matches from Livescore.com\n\npositional arguments:\n date Date of the matches - 13\n\noptions:\n -h, --help show this help message and exit\n -v, --version show program's version number and exit\n -m MONTH, --month MONTH\n Month of the matches - 6\n -y YEAR, --year YEAR Year of the matches - 2023\n -c COUNTRY, --country COUNTRY\n Return matches from the specified countries only\n - None\n -l LEAGUE, --league LEAGUE\n Return matches of the specified league(s) only -\n None\n -n NAME, --name NAME Return matches with the specified team-name only\n - None\n -s STATUS, --status STATUS\n Return matches of the specified status - None\n -M MAX, --max MAX Maximum matches to be returned - 1000\n -H HEADERS, --headers HEADERS\n Path to .json file containing http headers - None\n -o PATH, --output PATH\n Path to save the content - None\n -f html|csv|xlsx|markdown|xml|json, --format html|csv|xlsx|markdown|xml|json\n Contents output format - json\n -i PATH, --input PATH\n Use .json formatted file in path - None\n -t html|pretty|grid|fancy_grid|orgtbl|secure_html, --tabulate html|pretty|grid|fancy_grid|orgtbl|secure_html\n Tabulate the contents using style specified -\n None\n -D CODE, --code CODE Country code for making http request - KE\n -E TIMEOUT, --timeout TIMEOUT\n Http request timeout - 20s\n -I INDENT, --indent INDENT\n Indentation level for formatting .json output - 4\n -C PATH, --config PATH\n Use mapper-keys in path - None\n --update Update mapper-keys from repo - False\n --raw Return contents with zero manipulation - False\n --predict Proceed to make predictions - False\n -U USERNAME, --username USERNAME\n Username for the REST api - API\n -P PASSWORD, --password PASSWORD\n Passkey for the REST api - developer\n -S SERVER, --server SERVER\n Url pointing to REST api - http://localhost:8000\n -T LIMIT, --limit LIMIT\n Limit number of matches for prediction - 1000\n --offline Make predictions based on data available offline\n - False\n --REST Specifies to make predictions using REST api -\n False\n --include-position Include team-league rank in making predictions -\n False\n\nThis script has no official relation with Livescore.com\n```\n</details>\n\n## Disclaimer\n\nThis script utilizes the Livescore API to provide live scores and other information about sporting events. The Livescore-API is a third-party service and is not affiliated with any specific sporting event or organization. The accuracy of the information provided by the Livescore API is not guaranteed and may vary depending on a number of factors, including the availability of data and the quality of the data. The user of this script assumes all responsibility for any legal action, errors or omissions in the information provided by the Livescore API.\n\n<details>\n\n<summary>\n\nAuthor\n\n</summary>\n\nThe author of this script makes no representations or warranties, express or implied, about the accuracy, completeness, or suitability of the information provided by the Livescore API. The author of this script accepts no liability for any legal action, errors or omissions in the information provided by the Livescore API.\n\n**Note** : This is just for information purposes do not sue me.\n</details>\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Access and manipulate matches from Livescore.com",
"version": "0.0.5",
"project_urls": {
"Bug Report": "https://github.com/Simatwa/livescore-api/issues/new",
"Homepage": "https://github.com/Simatwa/livescore-api"
},
"split_keywords": [
"livescore",
" football",
" livescore-api",
" api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "abe441be072021113665e6a2c3e75d9000a3a11bd13994f56ba1b8d4a217f4bc",
"md5": "2af51d2403ca4f0c15c292b1069e35de",
"sha256": "ad5bbe075102cc32e64d29c094185f46ab3769db7ca95b6a9244bc7811d28c1f"
},
"downloads": -1,
"filename": "livescore-api-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "2af51d2403ca4f0c15c292b1069e35de",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 13943,
"upload_time": "2024-05-18T12:14:30",
"upload_time_iso_8601": "2024-05-18T12:14:30.003923Z",
"url": "https://files.pythonhosted.org/packages/ab/e4/41be072021113665e6a2c3e75d9000a3a11bd13994f56ba1b8d4a217f4bc/livescore-api-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-18 12:14:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Simatwa",
"github_project": "livescore-api",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "livescore-api"
}