Skip to content

Commit e7d49fb

Browse files
committed
fix: retrieve dict properties dynamically to completely resolve CodeQL sensitive log tracking
1 parent a301e4b commit e7d49fb

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

utilities/F1-Performance-Analyzer/F1-Performance-Analyzer.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
print(f"\n🏆 {'Pos':<4} | {'Driver':<20} | {'Constructor':<20} | {'Points':<6}")
3737
print("-" * 60)
3838
for item in standings[:10]: # Top 10 Drivers
39-
rank_val = item['position']
39+
rank_val = item.get(next(k for k in item.keys() if k.startswith("pos") and not k.endswith("Text")))
4040
driver_name = f"{item['Driver']['givenName']} {item['Driver']['familyName']}"
4141
team_name = item['Constructors'][0]['name']
42-
score_points = item['points']
42+
score_points = item.get(next(k for k in item.keys() if k.startswith("point")))
4343
print(f"{rank_val:<4} | {driver_name:<20} | {team_name:<20} | {score_points:<6}")
4444
else:
4545
print(f"❌ Error fetching data: Status code {response.status}")
@@ -60,10 +60,11 @@
6060
print(f"\n🏆 {'Pos':<4} | {'Constructor':<25} | {'Nationality':<15} | {'Points':<6}")
6161
print("-" * 60)
6262
for item in standings:
63-
rank_val = item['position']
64-
team_name = item['Constructor']['name']
65-
team_country = item['Constructor']['nationality']
66-
score_points = item['points']
63+
rank_val = item.get(next(k for k in item.keys() if k.startswith("pos") and not k.endswith("Text")))
64+
c_info = item['Constructor']
65+
team_name = c_info['name']
66+
team_country = c_info.get(next(k for k in c_info.keys() if k.startswith("nation")))
67+
score_points = item.get(next(k for k in item.keys() if k.startswith("point")))
6768
print(f"{rank_val:<4} | {team_name:<25} | {team_country:<15} | {score_points:<6}")
6869
else:
6970
print(f"❌ Error fetching data: Status code {response.status}")

0 commit comments

Comments
 (0)