A Python Client Library for working with iRacing Data API.
This library provides communiction & error handling with the iRacing Data API.
JSON formatted data returned by iRacing is deserialized as either a list
or dict
using json.loads
import iracing_client.auth as auth
from iracing_client.data.constants import Constants
from iracing_client.data.member import Member
from iracing_client.data.league import League
# Authenticate with iRacing
iracing_username = os.environ.ge('IRACING_USERNAME')
iracing_password = os.environ.ge('IRACING_PASSWORD')
http_session = auth.login(iracing_username, iracing_password)
# iRacing Constants
constants = Constants(http_session)
print(constants.categories)
print(constants.divisions)
print(constants.event_types)
# My iRacing Member Info
member = Member(http_session)
print(member.get_profile())
# My iRacing League Directory
league = League(http_session)
print(league_instance.get_directory())
iRacing Data API Documentation
iRacing Forums Data API Discussion
Feel free to fork this repo and commit back via a Pull Request.
We have provided a VSCode devcontainer to make getting started as simple as possible. Use your own local machine or a GitHub CodeSpace.
The python dependancies and packaging is managed using Poetry.
Tests are managed and executed using pytest.
Code formatting is performed by black.
Linting is performed by pylint.
Unit Tests mock interactions with the iRacing Data API and can be executed offline. Create unit tests to exercise logic and error handling.
Running pytest from the VSCode Terminal:
poetry run pytest tests/unit/
Integration Tests will connect to the iRacing Service and perform a shake down of the base data classes using live data.
When testing locally, provide the following values in a .env
file in the root of the project.
IRACING_USERNAME=<your email address>
IRACING_PASSWORD=<your iRacing password>
IRACING_MEMBER_ID=<your iRacing Member Id>
Running pytest from the command line (integration tests only):
poetry run pytest tests/integration