Vehicle
Vehicle Class Documentation
Represents a racing vehicle with details such as number, manufacturer, chassis, engine, tire, and associated team.
Attributes:
Name | Type | Description |
---|---|---|
vehicle_json |
dict
|
JSON data containing vehicle details. |
espn_instance |
An instance of the ESPN API client. |
|
number |
str or None
|
The vehicle's number. |
manufacturer |
str or None
|
The vehicle's manufacturer. |
chassis |
str or None
|
The vehicle's chassis type. |
engine |
str or None
|
The engine used in the vehicle. |
tire |
str or None
|
The tire manufacturer. |
team |
str or None
|
The team associated with the vehicle. |
Methods:
Name | Description |
---|---|
_set_vehicle_data |
Extracts and sets vehicle details from the JSON data. |
Source code in pyespn/classes/vehicle.py
espn_instance
property
PYESPN: the espn client instance associated with the class
__init__(vehicle_json, espn_instance)
Initializes a Vehicle instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vehicle_json
|
dict
|
JSON data containing vehicle details. |
required |
espn_instance
|
PYESPN
|
An instance of the ESPN API client. |
required |
Source code in pyespn/classes/vehicle.py
__repr__()
Returns a string representation of the Vehicle instance.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A formatted string with the Vehicles name. |
to_dict()
Converts the Vehicle instance to its original JSON dictionary.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
The vehicle's raw JSON data. |