8989async def main ():
9090 parser = argparse .ArgumentParser ()
9191 parser .add_argument ('--run' , help = 'all | taiga | sesame' ,default = 'all' )
92+ parser .add_argument ('--imports' , help = 'all | ind | pictures' ,default = 'all' )
9293 parser .add_argument ('--an' , help = 'Année universitaire à importer ' ,default = "0" )
9394 args = parser .parse_args ()
9495 if args .an != 0 :
@@ -100,13 +101,21 @@ async def main():
100101 logger .info ("Starting Taiga crawler..." )
101102 await a_moins_b (url , 0 , - 1 , headers )
102103 collection_tasks = [col .get ('function' )(url , col , headers ) for col in collections ]
104+
105+ if args .imports == 'ind' or args .imports == 'all' :
106+ collection_tasks = [col .get ('function' )(url , col , headers ) for col in collections if col .get ('method' ) != 'ExportPhotos' ]
107+ elif args .imports == 'pictures' or args .imports == 'all' :
108+ collection_tasks = [col .get ('function' )(url , col , headers ) for col in collections if col .get ('method' ) == 'ExportPhotos' ]
109+
103110 await asyncio .gather (* collection_tasks )
104111 print ("Taiga crawler ended successful !!!" )
105112 if args .run == 'sesame' or args .run == 'all' :
106113 print ("Starting import_ind..." )
107114 start_time = datetime .now ()
108- await import_ind ()
109- await import_pictures ()
115+ if (args .imports == 'ind' or args .imports == 'all' ):
116+ await import_ind ()
117+ elif (args .imports == 'pictures' or args .imports == 'all' ):
118+ await import_pictures ()
110119 end_time = datetime .now ()
111120 execution_time = end_time - start_time
112121 print (f"import_ind completed in { execution_time } " )
0 commit comments