#NEWLINE# def main( ) : #NEWLINE# #INDENT# riotapi . set_region ( 'NA' ) #NEWLINE# riotapi . print_calls ( True ) #NEWLINE# key = os . environ [ 'DEV_KEY' ] #NEWLINE# riotapi . set_api_key ( key ) #NEWLINE# riotapi . set_load_policy ( LoadPolicy . lazy ) #NEWLINE# db = SQLAlchemyDB ( 'mysql+mysqlconnector' , 'databse_hostname' , 'database_name' , 'username' , 'password' ) #NEWLINE# riotapi . set_data_store ( db ) #NEWLINE# unpulled_summoners = deque ( ( entry . summoner for entry in riotapi . get_master ( ) ) ) #NEWLINE# print ( 'Pulled Master tier for seeding. Got {0} summoners.' . format ( len ( unpulled_summoners ) ) ) #NEWLINE# pulled_summoners = deque ( ) #NEWLINE# gather_start = datetime ( 2015 , 7 , 23 ) #NEWLINE# while ( len ( unpulled_summoners ) > 0 ) : #NEWLINE# #INDENT# summoner = unpulled_summoners . popleft ( ) #NEWLINE# for match_reference in summoner . match_list ( begin_time = summoner ) : #NEWLINE# #INDENT# match = riotapi . get_match ( match_reference ) #NEWLINE# print ( 'Stored {0} in my database' . format ( match ) ) #NEWLINE# for participant in match . participants : #NEWLINE# #INDENT# if ( ( participant . summoner not in unpulled_summoners ) and ( participant . summoner not in pulled_summoners ) ) : #NEWLINE# #INDENT# unpulled_summoners . append ( participant . summoner ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# pulled_summoners . append ( summoner ) #NEWLINE# #UNINDENT# db . close ( )