Skip to content

Exceptions

Every exception that pysportbot raises derives from SportBotError, and all of them can be imported from pysportbot. Network errors are the one exception: they propagate as requests.RequestException.

SportBotError
├── APIError
├── AuthenticationError
├── NotLoggedInError
├── ConfigError
├── CentreNotFoundError
├── ActivityNotFoundError
├── SlotNotFoundError
├── BookingError
│   ├── SlotAlreadyBookedError
│   ├── SlotUnavailableError
│   ├── SlotNotBookableYetError
│   └── SlotFullError
└── CancellationError

SportBotError

Bases: Exception

Base class for every error raised by pysportbot.

APIError

Bases: SportBotError

The API returned an unexpected HTTP status, a non-JSON body or a body with missing fields.

AuthenticationError

Bases: SportBotError

Logging in failed, because of bad credentials or an unexpected authentication response.

NotLoggedInError

Bases: SportBotError

The method requires a successful login first.

ConfigError

Bases: SportBotError

The service configuration is invalid.

CentreNotFoundError

Bases: SportBotError

The account is not registered at the centre.

ActivityNotFoundError

Bases: SportBotError

The activity is not offered by the centre.

SlotNotFoundError

Bases: SportBotError

No slot of the activity starts at the requested time.

BookingError

Bases: SportBotError

Booking a slot failed. Raised directly for API error codes without a dedicated subclass.

SlotAlreadyBookedError

Bases: BookingError

The slot is already booked by the user (API error code 5).

SlotUnavailableError

Bases: BookingError

The slot is not available for booking (API error code 6).

SlotNotBookableYetError

Bases: BookingError

The booking window of the slot has not opened yet (API error code 28).

SlotFullError

Bases: BookingError

The slot has no places left. Detected before any booking request is sent.

CancellationError

Bases: SportBotError

Cancelling a slot failed, e.g. because the slot was not booked.