Untitled

mail@pastecode.io avatar
unknown
python
15 days ago
1.1 kB
1
Indexable
Never
from cassiopeia import riotapi
import sys
import time

##OPTIONS
Region ='LAN'
APIkey = '87434b6c-7bf2-4cb0-9db5-d8b544c7f75f'
IDstart = 1
IDend = 2500


start_time = time.time()
file = open('%s' % Region + " - " + str(IDstart) + "-" + str(IDend) +".txt", 'a')
file.write("[--- IDs " + str(IDstart) + " - " + str(IDend) + " on the " + str(Region) + " server ---]" + '\n \n')
file.write("Start Time:")
file.write('\n')
file.write(time.strftime("%I:%M:%S"))
file.write('\n')

riotapi.set_region(Region)
riotapi.set_api_key(APIkey)

while (IDstart <= IDend):
    try:
        summoner = riotapi.get_summoner_by_id(IDstart)
        file.write("ID: {summonid} - Name: {name}".format(name=summoner.name, summonid=summoner.id, level=summoner.level))
        file.write('\n')
    except:
            print("ID:" + str(IDstart) + " Error")
    IDstart = IDstart + 1
    file.flush()
    
file.write('\n')
file.write("End Time:")
file.write('\n')
file.write(time.strftime("%I:%M:%S"))
file.write('\n')
file.write("Completed in %s seconds" % (time.time() - start_time))
file.write('\n')

file.close()
Leave a Comment