diff --git a/client_test.py b/client_test.py
index f5d9023..20cb4e4 100644
--- a/client_test.py
+++ b/client_test.py
@@ -127,7 +127,8 @@ async def test_member_subsession_id_from_session(self):
@async_test
async def test_driver_status(self):
response = await client.driver_status(499343)
- self.assertIsInstance(response, iracing_data.DriverStatus)
+ for driver_status in response:
+ self.assertIsInstance(driver_status, iracing_data.DriverStatus)
@async_test
async def test_next_event(self):
diff --git a/docs/functions.md b/docs/functions.md
index 3250a24..33ec65e 100644
--- a/docs/functions.md
+++ b/docs/functions.md
@@ -45,14 +45,11 @@ friend=None
watched=None
recent=None | Accepts a `cust_id` to f
cust_id=None | Does not affect returned data
### driver_status()
-Returns friends list for the person logged in. (gold star for least useful)
+Returns a list of driver statuses determined by the provided search_terms argument.
| Args/Kwargs| Description |
|:---|:---|
-cust_id=None| Returns the status info of the provided cust_id. If logged in while also providing **your** custid, it will also return the status info of your friends and studied/blacklisted drivers.
-friends=1| Toggles display of friends in results.
-studied=1| Toggles display of studied drivers in results.
-blacklisted=1| Toggles display of blacklisted drivers in results.
+search_terms='null'| Return status info of the provided search term. Can be used to search for status info of specific drivers using name ie. `'John Anderson5'`. You can also search for drivers with their cust_id ie. `111111`.
### event_results()
Returns a list of event results that the driver has participated in. This is the backend data for iRacing's [My Series Results](https://members.iracing.com/membersite/member/results.jsp). Contains the summary information about the results of the event. For detailed information about a specific session, see: [subsession_data()](#subsession_data).
diff --git a/pyracing/client.py b/pyracing/client.py
index 2674cb8..efd6fa3 100644
--- a/pyracing/client.py
+++ b/pyracing/client.py
@@ -507,15 +507,16 @@ async def member_subsession_id_from_session(self, cust_id, session_id):
response = await self._build_request(url, payload)
return response.json()
- async def driver_status(self, cust_id):
+ async def driver_status(self, search_terms='null'):
""" Returns information about the member's current status. If logged
in while also providing your custid, it will return the same info for
your friends along with studied, and blacklisted drivers.
"""
- payload = {'custId': cust_id}
+ payload = {'searchTerms': search_terms}
url = ct.URL_DRIVER_STATUS
response = await self._build_request(url, payload)
- return iracing_data.DriverStatus(response.json())
+ return [iracing_data.DriverStatus(x) for
+ x in response.json()["searchRacers"]]
async def next_event(
self,
diff --git a/pyracing/response_objects/iracing_data.py b/pyracing/response_objects/iracing_data.py
index 8277c78..8805744 100644
--- a/pyracing/response_objects/iracing_data.py
+++ b/pyracing/response_objects/iracing_data.py
@@ -91,31 +91,28 @@ def __init__(self, data):
class DriverStatus:
def __init__(self, data):
- status = data['status']
-
- self.name = parse_encode(status.get('name'))
+ self.broadcast = data.get('broadcast')
+ self.driver_changes = data.get('driverChanges')
self.last_login = datetime_from_iracing_timestamp(
- status.get('lastLogin'))
+ data.get('lastLogin'))
+ self.users_max = data.get('maxUsers')
+ self.track_id = data.get('trackId')
+ self.session_status = data.get('sessionStatus')
+ self.session_type_id = data.get('sessionTypeId')
+ self.private_session = data.get('privateSession')
+ self.series_id = data.get('seriesId')
+ self.reg_open = data.get('regOpen')
+ self.cat_id = data.get('catId')
+ self.event_type_id = data.get('eventTypeId')
+ self.spotter_access = data.get('spotterAccess')
self.last_seen = datetime_from_iracing_timestamp(
- status.get('lastSeen'))
- self.broadcast = status.get('broadcast')
- self.driver_changes = status.get('driverChanges')
- self.users_max = status.get('maxUsers')
- self.has_grid = status.get('hasGrid')
- self.private_session = status.get('privateSession')
- self.series_id = status.get('seriesId')
- self.reg_open = status.get('regOpen')
- self.spotter_access = status.get('spotterAccess')
- self.season_id = status.get('seasonId')
- self.helmet = Helmet(status['helmet'])
- self.in_grid = status.get('inGrid')
- self.start_time = status.get('startTime')
- self.subsession_status = status.get('subSessionStatus')
- self.track_id = status.get('trackId')
- self.session_status = status.get('sessionStatus')
- self.session_type_id = status.get('sessionTypeId')
- self.cat_id = status.get('catId')
- self.event_type_id = status.get('eventTypeId')
- self.private_session_id = status.get('privateSessionId')
- self.cust_id = status.get('custid')
- self.user_role = status.get('userRole')
+ data.get('lastSeen'))
+ self.season_id = data.get('seasonId')
+ self.helmet = Helmet(data['helmet'])
+ self.private_session_id = data.get('privateSessionId')
+ self.cust_id = data.get('custid')
+ self.name = parse_encode(data.get('name'))
+ self.trusted_as_spotter = data.get('trustedAsSpotter')
+ self.start_time = data.get('startTime')
+ self.user_role = data.get('userRole')
+ self.subsession_status = data.get('subSessionStatus')