LiveTimingF1 Adapter - livef1.adapters.livetimingf1_adapter
¶
Functions
|
Retrieves data from the Livetiming F1 API, either as a stream of records or a static response. |
|
Wrapper function to perform a GET request to the Livetiming F1 API. |
Classes
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:
- endpoint
str
The specific API endpoint to append to the base URL.
- header
dict
HTTP headers to send with the request (default is None).
- endpoint
- 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:
- url
str
The full URL to request.
- stream
bool
If True, treats the response as a stream of newline-separated records. If False, treats it as a static JSON response.
- url
- Returns:
- dict
A dictionary containing parsed data. If streaming, each line is parsed and split.