blob: bf81bfb934cc016083fba87e6560042ec45b851e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/bin/python3
import os
import sys
import urllib.request
global YEAR
USE_LOCAL_CACHE = True
API_BASE_URL = "https://ergast.com/"
def api_request(endpoint):
conn = urllib.request.urlopen(API_BASE_URL + endpoint)
return conn.read()
def main():
print(f"fetching year {YEAR}")
if __name__ == "__main__":
if len(sys.argv) < 2:
print("please provide a year to fetch f1 data from")
exit(1)
YEAR = int(sys.argv[1])
main()
|