forked from jeysonmc/ir_webstats
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexamples.py
More file actions
40 lines (36 loc) · 1.41 KB
/
examples.py
File metadata and controls
40 lines (36 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/python
""" Example usage of iRWebStats """
from ir_webstats import constants as ct
from ir_webstats.client import iRWebStats
from ir_webstats.util import clean
user = 'user' # iRacing username and password
password = 'password'
irw = iRWebStats()
irw.login(user, password)
if not irw.logged:
print (
"Couldn't log in to iRacing Membersite. Please check your credentials")
exit()
# Cars driven by user
irw.format_series()
r = irw.get_best_lap_from_current_raceweek("Simon Dubois") # Returns cars id
print(r)
# print("\n--> 1. Cars driven by custid:%s \n" % (irw.custid))
# print("\n".join([irw.CARS[c]['id'] for c in r]))
#
# # Career stats
# r = irw.career_stats()
# print("\n--> 2. Career stats for custid:%s \n" % (irw.custid))
# print(("Starts: %s, Wins: %s, Top 5: %s, Total Laps: %s," +
# " Laps Led: %s") % (r['starts'], r['wins'], r['top5'], r['totalLaps'],
# r['lapsLed']))
#
# # Driver search
# print("\n--> 3. Driver search (Road racers with Average finish from 1 to 3)\n")
# drivers, total_drv = irw.driver_search(
# race_type=ct.RACE_TYPE_ROAD, avg_finish=(1, 3), active=True, page=1)
#
# print("Total drivers found: %s. Showing the first %s" % (total_drv,
# len(drivers)))
# print("\n".join(["%s - %s: %s" % (i + 1, clean(x['displayname']), x['irating'])
# for i, x in enumerate(drivers)]))