From: Benjamin Mako Hill Date: Wed, 1 Apr 2020 15:47:33 +0000 (-0500) Subject: fix bugs with the date stamps X-Git-Url: https://code.communitydata.science/covid19.git/commitdiff_plain/06d2fd156335b6bb83966ea89f4b7283055ad946?ds=inline fix bugs with the date stamps --- diff --git a/wikipedia/scripts/fetch_enwiki_daily_views.py b/wikipedia/scripts/fetch_enwiki_daily_views.py index c250bfe..225b06d 100755 --- a/wikipedia/scripts/fetch_enwiki_daily_views.py +++ b/wikipedia/scripts/fetch_enwiki_daily_views.py @@ -47,8 +47,6 @@ def main(): yesterday = datetime.datetime.today() - datetime.timedelta(days=1) queryDate = yesterday.strftime("%Y%m%d") - queryDate = queryDate + "00" #requires specifying hours - #handle -L loglevel_mapping = { 'debug' : logging.DEBUG, 'info' : logging.INFO, @@ -92,7 +90,7 @@ def main(): #2 Repeatedly call the API with that list of names for a in articleList: a = a.strip("\"\n") #destringify - url= f"https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia/all-access/all-agents/{a}/daily/{queryDate}/{queryDate}" + url= f"https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia/all-access/all-agents/{a}/daily/{queryDate}00/{queryDate}00" response = requests.get(url) if response.ok: diff --git a/wikipedia/scripts/fetch_enwiki_revisions.py b/wikipedia/scripts/fetch_enwiki_revisions.py index cbb283d..3ecd04f 100755 --- a/wikipedia/scripts/fetch_enwiki_revisions.py +++ b/wikipedia/scripts/fetch_enwiki_revisions.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!yusr/bin/env python3 ############################################################################### # @@ -44,8 +44,6 @@ def main(): yesterday = datetime.datetime.today() - datetime.timedelta(days=1) query_date = yesterday.strftime("%Y%m%d") - query_data = query_date + "00" #requires specifying hours - #handle -L loglevel_mapping = { 'debug' : logging.DEBUG, 'info' : logging.INFO, @@ -73,7 +71,7 @@ def main(): logging.info(f"Last commit: {export_git_hash}") json_output_filename = os.path.join(output_path, f"digobs_covid19-wikipedia-enwiki_revisions-{query_date}.json") - tsv_output_filename = os.path.join(output_path, f"digobs_covid19-wikipedia-enwiki_revisions-{query_data}.tsv") + tsv_output_filename = os.path.join(output_path, f"digobs_covid19-wikipedia-enwiki_revisions-{query_date}.tsv") api_session = api.Session("https://en.wikipedia.org/w/api.php")