X-Git-Url: https://code.communitydata.science/covid19.git/blobdiff_plain/070d23f71854b43c22f11d3e26bceca8b2a1de3c..f770ade87a6e06828f015147f28c1a8334878731:/wikipedia/scripts/fetch_enwiki_daily_views.py?ds=sidebyside diff --git a/wikipedia/scripts/fetch_enwiki_daily_views.py b/wikipedia/scripts/fetch_enwiki_daily_views.py index 7015a3b..829343d 100755 --- a/wikipedia/scripts/fetch_enwiki_daily_views.py +++ b/wikipedia/scripts/fetch_enwiki_daily_views.py @@ -26,7 +26,7 @@ def parse_args(): 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('-d', '--query_date', help='Date if not yesterday, in YYYYMMDD format.', 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) @@ -45,14 +45,11 @@ def main(): yesterday = datetime.datetime.today() - datetime.timedelta(days=1) query_date = yesterday.strftime("%Y%m%d") - #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")