Untitled

mail@pastecode.io avatar
unknown
python
14 days ago
1.9 kB
3
Indexable
Never
API Checker v03.txt

from cassiopeia import riotapi
import sys
import time
riotapi.set_rate_limits((3000, 10), (180000, 600))


##sumIDstart - Start of the Summoner IDs you wish to scrape
##summIDend - End of the Summoner IDs you wish to scrape
##region - The region you wish to scrape from (NA, EUW, EUNE, LAN, LAS, BR, TR, JP)
##place your API Keys in the 'apikeys.txt'
summIDstart = 60000
summIDend = 120000
region = 'JP'
speed = 40
###########################


currentKey = 0
keyFile = open("apikeys.txt", "r")
keys = keyFile.read().splitlines()


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

#Main
riotapi.set_region(region)
while (summIDstart <= summIDend):


    rangeStart = summIDstart
    rangeEnd = summIDstart+speed

    Var1 = range(rangeStart, rangeEnd)

    try:
        CurKey = keys[currentKey]
        riotapi.set_api_key(CurKey)
        summoners = riotapi.get_summoner_names(list(Var1))
        listed = "\n".join(item for item in summoners)
        file.write (str(listed))
        file.write('\n')
#       file.write (str(summoners))
        if currentKey == len(keys)-1:
            currentKey = 0
        else:
            currentKey = currentKey + 1
    except Exception as e:
#       file.write (str(e))
        file.write('----Error----' + str(Var1))
        file.write('\n')
    summIDstart = summIDstart+speed

    file.flush()
# End Main
file.write('\n')
file.write("End Time:")
file.write('\n')
file.write(time.strftime("%I:%M:%S"))
file.write('\n')
print("Completed in %s Seconds" % (time.time() - start_time))
file.write("Completed in %s Seconds" % (time.time() - start_time))
file.write('\n')

file.close()
Leave a Comment