]> code.communitydata.science - covid19.git/blobdiff - wikipedia/scripts/fetch_enwiki_revisions.py
Merge pull request #20 from makoshark/master
[covid19.git] / wikipedia / scripts / fetch_enwiki_revisions.py
index 2c0ef7ab1aed2d179507258416ef9544b550cbc5..2d25e85d0bfbe1a7c4fefa7c346270456bc9c5db 100755 (executable)
@@ -26,7 +26,7 @@ def parse_args():
     parser = argparse.ArgumentParser(description='Call the views API to collect Wikipedia revision data.')
     parser.add_argument('-o', '--output_folder', help='Where to save output', default="wikipedia/data", type=str)
     parser.add_argument('-i', '--article_file', help='File listing article names', default="wikipedia/resources/enwp_wikiproject_covid19_articles.txt", type=str)
-    parser.add_argument('-L', '--logging_level', help='Logging level. Options are debug, info, warning, error, critical. Default: info.', default='info', type=str), 
+    parser.add_argument('-L', '--logging_level', help='Logging level. Options are debug, info, warning, error, critical. Default: info.', default='info', type=digobs.get_loglevel), 
     parser.add_argument('-W', '--logging_destination', help='Logging destination file. (default: standard error)', type=str), 
     args = parser.parse_args()
     return(args)
@@ -37,14 +37,11 @@ def main():
     output_path = args.output_folder
     article_filename = args.article_file
 
-    #handle -L
-    loglevel = digobs.get_loglevel(args.logging_level)
-
     #handle -W
     if args.logging_destination:
-        logging.basicConfig(filename=args.logging_destination, filemode='a', level=loglevel)
+        logging.basicConfig(filename=args.logging_destination, filemode='a', level=args.logging_level)
     else:
-        logging.basicConfig(level=loglevel)
+        logging.basicConfig(level=args.logging_level)
 
     export_time = str(datetime.datetime.now())
     export_date = datetime.datetime.today().strftime("%Y%m%d")

Community Data Science Collective || Want to submit a patch?