This program tries to book a tennis court slot in either Southwark Park or Tanner Street Park in Southwark, London.

Overview

Book tennis courts in London

This program tries to book a tennis court slot in either Southwark Park or Tanner Street Park in Southwark, London.

Note: Unfortunately, starting from November 1st 2021, tennis courts in Southwark won't be allowed to be booked for free anymore, and will require a card payment at the moment of booking. I haven't updated the script to reflect this, nor I plan to, hence effectively this script is deprecated (it will throw an exception at some point during the booking phase). I have published this repository nonetheless as an example, since it can be adapted for other booking systems with the appropriate modifications.

Table of Contents

  1. Overview
  2. Usage
  3. Some Examples

Overview

The program is made of one main file, book_tennis_court.py, which uses functions from helper.py and data from constants.py.

book_tennis_court.py can be run directly from the command line by invoking the python interpreter. It takes 3 argument:

  • times (positional arguments): indicate when (at what time) we want to book the court for
    • must be expressed in the form hour:minute (e.g. 8:00)
    • can be as many as you like (in case we have more than one option that works for us and we want to maximise the probability of finding an available court)
  • --date (or -d): the day we want to book the court for
    • can be expressed in absolute terms (in the form yyyy-mm-dd) or in relative terms (from 0 to 7), in which case it would indicate the day falling xdays in the future
    • accepts only 1 value
  • --wait (or -w): used to let the script know if we want to run it immediately or stop execution until a given time
    • can be no (if we want to run the entire script immediately) or in the form hour:minute:second (e.g. 20:0:0 (8pm))
    • accepts only 1 value

Usage

python book_tennis_court.py [-h] [--date [DATE]] [--wait [WAIT]] [times]

A help message can be displayed by typing: python book_tennis_court.py -h, which results in the message below appearing to the screen:

positional arguments:
times:  {8:00,8:30,9:00,9:30,10:00,10:30,11:00,11:30,12:00,12:30,13:00,13:30,14:00,
14:30,15:00,15:30,16:00,16:30,17:00,17:30,18:00,18:30,19:00,19:30,20:00,20:30}
                        The times that the script will try to book

optional arguments:
  -h, --help    show this help message and exit
  --date [DATE], -d [DATE]
                        The date that the script will try to book. Can be a
                        date, in which case it needs to be in the form 'yyyy-
                        mm-dd', or an integer, in which case it will indicate
                        the day falling 'date' days in the future.
                        Defaults to 7 (i.e. the day falling one week in the future)
  --wait [WAIT], -w [WAIT]
                        The time that the script will wait until making the
                        booking. Can either be 'no' (if we want to book
                        immediately) or be expressed in 'hour:minute:second').
                        Defaults to '20:0:0' (8pm)

Some Examples

Basic example

The booking system opens at 8pm each day for the day falling one week in the future. So, assuming we are on a Saturday (before 8pm!), the following command will make the script to book a slot at 4.00pm for the following Saturday:

python book_tennis_court.py 16:00

This is because the default values for --date and --wait are 7 (i.e., 7 days in the future) and 20:0:0 (i.e., 8pm) respectively.

Second example

Let's now assume we are on a Friday and would like to play the next day, but all courts have been booked. The only thing we can do is to hope that someone cancels their booking and book it ourselves - however free slots usually disappear really soon, so we need to keep checking and checking and checking!

We can authomate this by having our script run every, say, 5 minutes, which will check if a booking has been cancelled, in which case it will book it for us! Assuming we are free to play anytime between 9am and 11.30am (i.e. the last full hour would be from 10:30 to 11:30), the correct command would be:

python book_tennis_court.py 9:00 9:30 10:00 10:30 -w no -d 1

We can then make it run every 5 minutes with, for example, the cron utility (on Linux and MacOS) and hope that someone indeed cancel their booking :).

If we want to keep our script running overnight (so that past midnight it will need to try and book for the same day, not the day after), we should specify the date as follows (let's assume today is 26th October 2021):

python book_tennis_court.py 9:00 9:30 10:00 10:30 -w no -d 2021-10-27

Owner
Daniele
Daniele
Decoupled Smoothing in Probabilistic Soft Logic

Decoupled Smoothing in Probabilistic Soft Logic Experiments for "Decoupled Smoothing in Probabilistic Soft Logic". Probabilistic Soft Logic Probabilis

Kushal Shingote 1 Feb 08, 2022
Aim of the project is to reduce phishing victims. 😇

Sites: For more details visit our Blog. How to use 😀 : You just have to paste the url in the ENTER THE SUSPECTED URL section and SELECT THE RESEMBELI

0 May 19, 2022
51AC8 is a stack based golfing / esolang that I am trying to make.

51AC8 is a stack based golfing / esolang that I am trying to make.

7 May 22, 2022
A conda-smithy repository for boost-histogram.

The official Boost.Histogram Python bindings. Provides fast, efficient histogramming with a variety of different storages combined with dozens of composable axes. Part of the Scikit-HEP family.

conda-forge 0 Dec 17, 2021
The goal of this program was to find the most common color in my living room.

The goal of this program was to find the most common color in my living room. I found a dataset online with colors names and their corr

1 Nov 09, 2021
A Tool to validate domestic New Zealand vaccine passes

Vaccine Validator Tool to validate domestic New Zealand vaccine passes Create a new virtual environment: python3 -m venv ./venv Activate virtual envi

8 May 01, 2022
Encode and decode cancro lang files to and from brainfuck

cancrolang Encode and decode cancro lang files to and from brainfuck. examples python3 main.py -f hello.cancro --run Hello World! the interpreter is n

witer33 1 Dec 20, 2021
Some out-of-the-box hooks for pre-commit

pre-commit-hooks Some out-of-the-box hooks for pre-commit. See also: https://github.com/pre-commit/pre-commit Using pre-commit-hooks with pre-commit A

pre-commit 3.6k Dec 29, 2022
A Linux webcam plugin for BGMv2 as used in our demos.

The goal of this repository is to supplement the main Real-Time High Resolution Background Matting repo with a working demo of a videoconferencing plu

Andrey Ryabtsev 144 Dec 27, 2022
Python Commodore BBS multi-client

python-cbm-bbs-petscii Python Commodore BBS multi-client This is intended for commodore 64, c128 and most commodore compatible machines (as the new Co

7 Sep 16, 2022
Coderslab Workshop Projects

Workshop Coderslab workshop projects that include: Guessing Game Lotto simulator Guessing Game vol.2 Guessing Game vol.3 Dice 2001 Game Technologies P

Szymon Połczyński 1 Nov 06, 2021
Simple AoC helper program you can use to develop your own solutions in python.

AoC-Compabion Simple AoC helper program you can use to develop your own solutions in python. Simply install it in your python environment using pip fr

Alexander Vollmer 1 Dec 20, 2021
tetrados is a tool to generate a density of states using the linear tetrahedron method from a band structure.

tetrados tetrados is a tool to generate a density of states using the linear tetrahedron method from a band structure. Currently, only VASP calculatio

Alex Ganose 1 Dec 21, 2021
Empresas do Brasil (CNPJs)

Biblioteca em Python que coleta informações cadastrais de empresas do Brasil (CNPJ) obtidas de fontes oficiais (Receita Federal) e exporta para um formato legível por humanos (CSV ou JSON).

BR-API: Democratizando dados do Brasil. 8 Aug 17, 2022
A web-based chat application that enables multiple users to interact with one another

A web-based chat application that enables multiple users to interact with one another, in the same chat room or different ones according to their choosing.

3 Apr 22, 2022
Virtual Assistant Using Python

-Virtual-Assistant-Using-Python Virtual desktop assistant is an awesome thing. If you want your machine to run on your command like Jarvis did for Ton

Bade om 1 Nov 13, 2021
Airbrake Python

airbrake-python Note. Python 3.4+ are advised to use new Airbrake Python notifier which supports async API and code hunks. Python 2.7 users should con

Airbrake 51 Dec 22, 2022
Criando um jogo de naves espaciais com Pygame. Para iniciantes em Python

Curso de Programação de Jogos com Pygame Criando um jogo de naves espaciais com Pygame. Para iniciantes em Python Pré-requisitos Antes de começar este

Flávio Codeço Coelho 33 Dec 02, 2022
An interactive course to git

OperatorEquals' Sandbox Git Course! Preface This Git course is an ongoing project containing use cases that I've met (and still meet) while working in

John Torakis 62 Sep 19, 2022
ToDo - A simple bot to keep track of things you need to do

ToDo A simple bot to keep track of things you need to do. Installation You will

3 Sep 18, 2022