LiveTimingF1 Adapter - livef1.adapters.livetimingf1_adapter

Functions

livetimingF1_getdata(url, stream)

Retrieves data from the Livetiming F1 API, either as a stream of records or a static response.

livetimingF1_request(url)

Wrapper function to perform a GET request to the Livetiming F1 API.

Classes

LivetimingF1adapters()

Adapter class for interacting with the F1 Livetiming API.

class livef1.adapters.livetimingf1_adapter.LivetimingF1adapters[source]

Adapter class for interacting with the F1 Livetiming API.

This class builds and sends HTTP requests to retrieve data from the static Livetiming API, using a base URL and various endpoints.

Methods

get(endpoint[, header])

Sends a GET request to the specified endpoint.

get(endpoint: str, header: Dict = None)[source]

Sends a GET request to the specified endpoint.

Parameters:
endpointstr

The specific API endpoint to append to the base URL.

headerdict

HTTP headers to send with the request (default is None).

Returns:
  • str: The response content decoded as a UTF-8 string.
livef1.adapters.livetimingf1_adapter.livetimingF1_getdata(url, stream)[source]

Retrieves data from the Livetiming F1 API, either as a stream of records or a static response.

Parameters:
urlstr

The full URL to request.

streambool

If True, treats the response as a stream of newline-separated records. If False, treats it as a static JSON response.

Returns:
dict

A dictionary containing parsed data. If streaming, each line is parsed and split.

livef1.adapters.livetimingf1_adapter.livetimingF1_request(url)[source]

Wrapper function to perform a GET request to the Livetiming F1 API.

Parameters:
urlstr

The full URL to request.

Returns:
dict

Parsed JSON response from the API.