Circuit
Circuit Class
A class to represent a Circuit.
This class takes a JSON response from an API and processes the data to create a Circuit object with relevant attributes. It provides details such as the circuit's name, address, type, laps, and fastest lap times, as well as any related diagrams and references to other objects like the fastest lap driver and track.
Attributes:
Name | Type | Description |
---|---|---|
api_ref |
str
|
The API reference URL for the circuit. |
id |
str
|
The unique identifier of the circuit. |
full_name |
str
|
The full name of the circuit. |
city |
str
|
The city where the circuit is located. |
country |
str
|
The country where the circuit is located. |
type |
str
|
The type of the circuit (e.g., street, permanent). |
length |
str
|
The length of the circuit. |
distance |
str
|
The total distance of the race at the circuit. |
laps |
int
|
The number of laps in the race at the circuit. |
turns |
int
|
The number of turns in the circuit. |
direction |
str
|
The racing direction (e.g., clockwise, counterclockwise). |
established |
int
|
The year when the circuit was established. |
fastest_lap_driver_ref |
Player
|
A reference to the fastest lap driver. |
fastest_lap_time |
str
|
The time of the fastest lap at the circuit. |
fastest_lap_year |
int
|
The year in which the fastest lap was recorded. |
track_ref |
str
|
A reference to the track. |
diagrams |
list
|
A list of diagrams related to the circuit. |
diagram_urls |
list
|
A list of URLs pointing to the circuit diagrams. |
Source code in pyespn/classes/venue.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
espn_instance
property
PYESPN: the espn client instance associated with the class
__init__(circuit_json, espn_instance)
Initializes a Circuit instance with data from a JSON response and an ESPN instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
circuit_json
|
dict
|
The JSON data containing information about the circuit. |
required |
espn_instance
|
object
|
The ESPN instance used for making API calls. |
required |
This method also calls _load_circuit_data to load the data into attributes.
Source code in pyespn/classes/venue.py
__repr__()
to_dict()
Converts the Circuit instance to its original JSON dictionary.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
The circuit's raw JSON data. |