Snooker Data API
Project description
Snooker :black_circle: :red_circle: :white_circle:
snooker
is a Python package providing thin wrapper over publicly available API for retrieving Snooker statistics.
What is Snooker ?
Following Wikipedia's definition:
Snooker (pronounced UK: /ˈsnuːkər/, US: /ˈsnʊkər/)[2][3] is a cue sport that was first played by British Army officers stationed in India in the second half of the 19th century. It is played on a rectangular table covered with a green cloth (or "baize"), with six pockets: one at each corner and one in the middle of each long side. Using a cue stick, the players[a] take turns to strike the white "cue ball" to pot the other twenty-one snooker balls in the correct sequence, accumulating points for each pot. An individual frame of snooker is won by the player who has scored the most points by the end of the frame. A snooker match ends with one of the players having won a predetermined number of frames, thus winning the match.
Getting started
Installation
pip install snooker
Api Usage
Snooker Org
from snooker.api import SnookerOrgApi
client = SnookerOrgApi()
player = client.player(5)
print(player)
Custom headers
Following snooker.org API documentation:
If you plan to collect data automatically please contact us so we can agree on what you should put in the header. E.g. "X-Requested-By": "PetersAndroidApp".
To achieve this, simply pass appropriate headers when instantiating the client:
from snooker.api import SnookerOrgApi
client = SnookerOrgApi(headers={'X-Requested-By': 'mgorsk1'})
JSON Data
Returned data is serialized using Python native functionality called dataclasses
. If you need to convert it to JSON, simply do:
from snooker.api import SnookerOrgApi
client = SnookerOrgApi()
player = client.player(5).to_dict()
print(player)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file snooker-0.6.0.tar.gz
.
File metadata
- Download URL: snooker-0.6.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88a5ba234d545cbc80af207b750d941d7734cc6f11d5b47894a86cc30ceeb313 |
|
MD5 | 363e7ae48800bdd549777f62adb682d9 |
|
BLAKE2b-256 | b207d4236a57946d3cd59855f106710c638f63a7e3f08b8c2c34b8d9704094be |
File details
Details for the file snooker-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: snooker-0.6.0-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5671a73dd607340015a5c1b977a14492bc7dd99965c0e38241df810809ffdb49 |
|
MD5 | 078cadb802fa4791e021d924b643d91f |
|
BLAKE2b-256 | d76793bb488460d9900d439e00fe1123ba12a441ea16fad5b1230c51fc14fbf6 |