-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
48 lines (38 loc) · 971 Bytes
/
main.py
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
41
42
43
44
45
46
47
48
from models.Playerlist import *
import time
def main():
with open("players.txt", 'r') as f:
players = f.readlines()
PlayerList = Playerlist()
#users that were not found in riot database
errorUsers = list()
j = 0
for player in players:
#make sure we dont exceed request limit from temp api
if(j<5):
j += 1
else:
j = 0
time.sleep(15)
# try and catch any errors requesting info from RIOT API
try:
PlayerList.addPlayer(player.strip('\n'))
except Exception as e:
errorUsers.append(e)
print(str(e))
if len(errorUsers) > 0:
print("Players not found in Riot Database for North America:")
with open("ErrorUsers.txt",'w') as errUsr:
for p in errorUsers:
print(p)
errUsr.write(str(p) + '\n')
#Create the Teams
PlayerList.createTeams()
print("Teams:")
print("-----------------------")
#print out all the teams
PlayerList.printTeams()
#convert output to csv
PlayerList.toCsv()
if __name__ == '__main__':
main()