11from scrappers .GniusScrapper import GniusScrapper , FEED_PATH as GNIUS_FEED_PATH
22from scrappers .BpifranceScrapper import BpifranceScrapper , FEED_PATH as BPI_FEED_PATH
3+ from scrappers .IleDeFranceScrapper import IleDeFranceScrapper , FEED_PATH as IDF_FEED_PATH
34
45import os
56import argparse
67
78
8- def main (verbose , update_bpi , update_gnius ):
9+ def main (verbose , update_bpi , update_gnius , update_idf ):
910 script_dir = os .path .dirname (os .path .abspath (__file__ ))
1011 feeds_dir = os .path .join (script_dir , "feeds" )
1112 os .makedirs (feeds_dir , exist_ok = True )
1213
1314 bpi_scrapper = BpifranceScrapper ()
1415 gnius_scrapper = GniusScrapper ()
16+ idf_scrapper = IleDeFranceScrapper ()
1517
1618 bpi_feed_file = BPI_FEED_PATH # os.path.join(feeds_dir, BPI_FEED_PATH)
1719 gnius_feed_file = GNIUS_FEED_PATH # os.path.join(feeds_dir, 'gnius_feed.xml')
20+ idf_feed_file = IDF_FEED_PATH # os.path.join(feeds_dir, 'idf_feed.xml')
1821
1922 if update_bpi :
2023 print (f"Updating { bpi_feed_file } ..." )
@@ -26,22 +29,29 @@ def main(verbose, update_bpi, update_gnius):
2629 gnius_scrapper .update_feed_file (gnius_feed_file , verbose = verbose )
2730 print (f"{ gnius_feed_file } updated." )
2831
32+ # Updating XML's file for IDF's appel à projets
33+ if update_idf :
34+ print (f"Updating { idf_feed_file } ..." )
35+ idf_scrapper .update_feed_file (idf_feed_file , verbose = verbose )
36+ print (f"{ idf_feed_file } updated." )
2937
3038if __name__ == "__main__" :
3139 parser = argparse .ArgumentParser (
3240 description = "Update feeds with optional verbosity."
3341 )
3442 parser .add_argument (
35- "--bpifrance" , action = "store_true" , help = "Update only bpifrance feed"
43+ "--bpifrance" , action = "store_true" , help = "Update only Bpifrance feed"
3644 )
37- parser .add_argument ("--gnius" , action = "store_true" , help = "Update only gnius feed" )
45+ parser .add_argument ("--gnius" , action = "store_true" , help = "Update only Gnius feed" )
46+ parser .add_argument ("--idf" , action = "store_true" , help = "Update only IDF feed" )
3847 parser .add_argument (
3948 "-v" , "--verbose" , action = "store_true" , help = "Enable verbose output"
4049 )
4150 args = parser .parse_args ()
4251
43- # Si ni bpifrance ni gnius n'est spécifié, on met à jour les deux
44- update_bpi = args .bpifrance or (not args .bpifrance and not args .gnius )
45- update_gnius = args .gnius or (not args .bpifrance and not args .gnius )
52+ # Si aucune option n'est spécifiée, on met à jour tous les feeds
53+ update_bpi = args .bpifrance or (not args .bpifrance and not args .gnius and not args .idf )
54+ update_gnius = args .gnius or (not args .bpifrance and not args .gnius and not args .idf )
55+ update_idf = args .idf or (not args .bpifrance and not args .gnius and not args .idf )
4656
47- main (args .verbose , update_bpi , update_gnius )
57+ main (args .verbose , update_bpi , update_gnius , update_idf )
0 commit comments