First thing you want when learning new library - shortest way to see it in action.
-
Install pyirsdk
-
Optional. Install ipython (interactive python interpretator with autocomplete functionality)
-
Optional. Open
C:\Users\...\Documents\iRacing\app.ini
and change:[Graphics] ... fullScreen=0
-
Go to iRacing website, and start test session with any car and with "Centripetal Circuit" (this track loads faster than others)
-
Start Python with
py
command (oripython
if installed in step 2.) and type:>>> import irsdk >>> ir = irsdk.IRSDK() >>> ir.startup() <<< True >>> ir['Speed'] <<< 0.0
When reading session data, you always must check it for existence first:
>>> if ir['WeekendInfo']:
>>> print(ir['WeekendInfo']['WeekendOptions']['StartingGrid'])
<<< '2x2 inline pole on left'
Most available variables (like ir['Speed']
) with descriptions you can find here.