Git Product home page Git Product logo

snooker's Introduction

Snooker ⚫ 🔴 ⚪

PyPI version Build Status License


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)

snooker's People

Contributors

mgorsk1 avatar tarnishingcolors avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

snooker's Issues

Add 'extended' flag to collect data with all relationship objects

Currently some objects return, amongst other fields, IDs to other objects available in snooker.org api. This issue proposes adding extended flag so object has already pulled detailed info about referred objects.

Example would be:

  1. Event Match contains Player1ID property. With extended flag this would be resolved with complete Player object.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.