Skip to main content

A simple wrapper around the iRacing General Data API

Project description

Coverage Quality Gate Status

About

iracing-data-api is a simple Python wrapper around the General Data API released by iRacing in January 2022 and documented here.

The client allows easy access to some of the most useful endpoints of the data API.

Pre-installation

Ensure that you have marked your account with iRacing for legacy authentication - accounts with 2FA will not work with the API. This is a limitation of iRacing, not this wrapper.

Installation

pip install iracingdataapi

Examples

from iracingdataapi.client import irDataClient

idc = irDataClient(username=[YOUR iRACING USERNAME], password=[YOUR iRACING PASSWORD])

# get the summary data of a member
idc.stats_member_summary(cust_id=20979)

# get latest results of a member
idc.stats_member_recent_races(cust_id=209179)

# get all laps for a specific driver in a race
idc.result_lap_data(subsession_id=43720351, cust_id=209179)

All available methods of irDataClient are included in client.py.

Contributing

I welcome all pull requests for improvements or missing endpoints over time as they are added by iRacing.

Changelog

1.2.3

  • Update result_search_hosted to remove the cust_id/host_cust_id requirement, and also add the team_id parameter. Thanks @glenbecker for that.

1.2.2

  • Added driver_list endpoint, thanks to @nylanderj for that
  • Corrected issues where if [parameter] would skip if the parameter was correctly set to 0, e.g. race_week_num. Thanks to @abelsm2 for that
  • Added initial test setup
  • Added type hints throughout

1.2.0 Thanks to @ablesm2 for these changes.

  • Added missing endpoints
    • time_attack_member_season_results() stats_member_recap() stats_member_division() series_past_seasons() league_roster()
  • Removed check for cust_id on methods that default the currently logged in member:
    • stats_member_summary() stats_member_yearly() stats_member_recent_races()

1.1.6

  • More rate limiting fixes

1.1.5

  • Add rate limiting to _get_resource

1.1.4

  • Fix result_search_series to correctly include finish_range_begin as an option
  • Fix season_spectator_subsessionids to correctly return the IDs rather than the object

1.1.3

  • Bug fix for some 5xx errors that are thrown by iRacing
  • Added the season_spectator_subsessionids() endpoint

1.1.0

  • Added docstrings to all methods for developer experience
  • Renamed series() to get_series() for consistency. Breaking change: For that same consistency, series has been reimplemented as a property which returns the series with their assets. To amend your implementation, either switch to get_series() or remove any brackets in your call of series.
  • Renamed get_carclass() to get_carclasses() to be more consistent with other endpoints. NOTE: get_carclass() will be removed in a future release.
  • Added assets to the returned data of tracks. If you prefer not to get those assets, use get_tracks().
  • Removed redundant cookie handling code, as that is all handled within requests.Session
  • Fixed a ratelimiting error
  • Fixed a ratelimiting bug
  • Fixed a bug related to empty results
  • Improved handling of results

1.0.6

  • Bug fix in result_lap_data method, which will now return an empty list for any cust_id/subsession_id combinations for which laps were not turned.

1.0.5

  • Added a wait when hitting a rate limit

1.0.4

  • Bug fix: Previously an attempt wouldn't be retried if the authentication data became stale. This release fixes that

1.0.3

1.0.2

  • Adjusted login flow to avoid logging in on instantiation of an irDataClient object
  • Login now happens either on the initial call to an iRacing endpoint, or whenever a 401 Unauthorized response is received form iRacing

1.0.1

  • Adjusted result_search_series to allow searches by date range without using season years and quarters.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iracingdataapi-1.2.3.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

iracingdataapi-1.2.3-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file iracingdataapi-1.2.3.tar.gz.

File metadata

  • Download URL: iracingdataapi-1.2.3.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for iracingdataapi-1.2.3.tar.gz
Algorithm Hash digest
SHA256 3ae1af78b11e97adca52a27630aa541cb9d20537e1b3a6b2474b022ca66bb260
MD5 cb722b19b831981cc030b9431b5222b9
BLAKE2b-256 aac914e4383ba6cbdcf41125500109a775d28a299af3f51368e6cabc3748367d

See more details on using hashes here.

File details

Details for the file iracingdataapi-1.2.3-py3-none-any.whl.

File metadata

  • Download URL: iracingdataapi-1.2.3-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for iracingdataapi-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9f94901877184fc0e60cf3209b0b0f1d4c4c855ec29b268141a56a02e53e1e13
MD5 e23f7b9a7030eebd99755d910e42c089
BLAKE2b-256 15d105e525932b1f40511abc082636a5f86ad20425c18a9e2d2ea643ca8c39d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page