alec-kr / F1PyStats

An open-source Python3 package that provides Formula 1 data to developers.
GNU General Public License v3.0
51 stars 19 forks source link

Add fastest_laps #96

Closed youpong closed 1 year ago

youpong commented 1 year ago

Description

I have taken over the work done halfway through PR #91. Here are the changes I made.

Implementation

The procedure to get the fastest lap has been changed significantly from PR #91. The reason is to reduce the server load.

In PR #91, all lap times were read and compared. I changed it as follows.

  1. Get the driverId and laps of the fastest lap from the following URL. https://ergast.com/api/f1/{year}/{round}/fastest/1/results

  2. get lap time from the following URL using the driverId and laps obtained above. https://ergast.com/api/f1/{year}/{round}/drivers/{driverId}/laps/{laps}

The function _get_sec() added in PR#91 has been removed (get_sec() implemented in PR#95 can be used for the same purpose).

Testing

The test is basically used as is, but the grand prix name has been removed.

Related Issue(s)

youpong commented 1 year ago

Wait for I'll make it pass the test.

youpong commented 1 year ago

The next error I just experienced. At that time, I tested again after a while and it succeeded.

E   socket.gaierror: [Errno -3] Temporary failure in name resolution
alec-kr commented 1 year ago

I think this is an issue with the Ergast API itself. Not sure when this will be resolved.

alec-kr commented 1 year ago

Do the functions still work in the package despite this error?

youpong commented 1 year ago

After a while, test it again. Hopefully the Ergast API is back.

alec-kr commented 1 year ago

The tests have now passed. Merging the PR.

Thank you for contributing once again.