CUSTOMER_ID = 404787
async def run(username: str, password: str):
ir = PyRacingClient(
username=username,
password=password,
)
await save_personal_results(ir, CUSTOMER_ID)
async def save_personal_results(
ir: PyRacingClient,
customer_id: int
):
results = await ir.event_results(cust_id=customer_id, quarter="3")
first_result = results[0]
subsession_results = await ir.subsession_data(subsession_id=first_result.subsession_id, cust_id=customer_id)
subsession_laps = await ir.race_laps_driver(subsession_id=first_result.subsession_id, cust_id=customer_id)
/home/mjholler/Git/mike.holler/iracing-stats/venv/bin/python /home/mjholler/Git/mike.holler/iracing-stats/ianalyze/cli/entrypoint.py example --username [email protected] --password Wb887esvDkl0 --database-file test.sqlite3
2020-07-27 16:53:08;INFO;No cookies in cookie jar.
2020-07-27 16:53:08;INFO;Authenticating...
2020-07-27 16:53:11;INFO;Login successful
2020-07-27 16:53:11;INFO;Request being sent to: https://members.iracing.com/memberstats/member/GetResults with params: {'custid': 404787, 'showraces': 1, 'showquals': None, 'showtts': None, 'showops': None, 'showofficial': 1, 'showunofficial': None, 'showrookie': 1, 'showclassd': 1, 'showclassc': 1, 'showclassb': 1, 'showclassa': 1, 'showpro': 1, 'showprowc': 1, 'lowerbound': 1, 'upperbound': 25, 'sort': 'start_time', 'order': 'desc', 'format': 'json', 'category[]': 2, 'seasonyear': 2020, 'seasonquarter': '3', 'raceweek': None, 'trackid': None, 'carclassid': None, 'carid': None, 'start_low': None, 'start_high': None, 'finish_low': None, 'finish_high': None, 'incidents_low': None, 'incidents_high': None, 'champpoints_low': None, 'champpoints_high': None}
2020-07-27 16:53:11;INFO;Request sent for URL: https://members.iracing.com/memberstats/member/GetResults?custid=404787&showraces=1&showquals=&showtts=&showops=&showofficial=1&showunofficial=&showrookie=1&showclassd=1&showclassc=1&showclassb=1&showclassa=1&showpro=1&showprowc=1&lowerbound=1&upperbound=25&sort=start_time&order=desc&format=json&category%5B%5D=2&seasonyear=2020&seasonquarter=3&raceweek=&trackid=&carclassid=&carid=&start_low=&start_high=&finish_low=&finish_high=&incidents_low=&incidents_high=&champpoints_low=&champpoints_high=
2020-07-27 16:53:11;INFO;Status code of response: 200
2020-07-27 16:53:11;INFO;Request being sent to: https://members.iracing.com/membersite/member/GetSubsessionResults with params: {'subsessionID': 33637167, 'custid': 404787}
2020-07-27 16:53:12;INFO;Request sent for URL: https://members.iracing.com/membersite/member/GetSubsessionResults?subsessionID=33637167&custid=404787
2020-07-27 16:53:12;INFO;Status code of response: 200
2020-07-27 16:53:12;INFO;Request being sent to: https://members.iracing.com/membersite/member/GetLaps with params: {'subsessionid': 33637167, 'simsessnum': 0, 'groupid': 404787}
2020-07-27 16:53:12;INFO;Request sent for URL: https://members.iracing.com/membersite/member/GetLaps?subsessionid=33637167&simsessnum=0&groupid=404787
2020-07-27 16:53:12;INFO;Status code of response: 200
2020-07-27 16:53:12;ERROR;Task exception was never retrieved
future: <Task finished name='Task-2' coro=<run() done, defined at /home/mjholler/Git/mike.holler/iracing-stats/ianalyze/example.py:9> exception=TypeError('string indices must be integers')>
Traceback (most recent call last):
File "/home/mjholler/Git/mike.holler/iracing-stats/ianalyze/example.py", line 15, in run
await save_personal_results(ir, CUSTOMER_ID)
File "/home/mjholler/Git/mike.holler/iracing-stats/ianalyze/example.py", line 26, in save_personal_results
subsession_laps = await ir.race_laps_driver(subsession_id=first_result.subsession_id, cust_id=customer_id)
File "/home/mjholler/Git/mike.holler/iracing-stats/venv/lib/python3.8/site-packages/pyracing/client.py", line 605, in race_laps_driver
return [session_data.RaceLapsDriver(x) for x in response.json()]
File "/home/mjholler/Git/mike.holler/iracing-stats/venv/lib/python3.8/site-packages/pyracing/client.py", line 605, in <listcomp>
return [session_data.RaceLapsDriver(x) for x in response.json()]
File "/home/mjholler/Git/mike.holler/iracing-stats/venv/lib/python3.8/site-packages/pyracing/response_objects/session_data.py", line 228, in __init__
self.driver = self.Driver(dict['drivers'])
TypeError: string indices must be integers
2020-07-27 16:53:12;ERROR;An open stream object is being garbage collected; call "stream.close()" explicitly.
2020-07-27 16:53:12;ERROR;An open stream object is being garbage collected; call "stream.close()" explicitly.
Process finished with exit code 0