]> code.communitydata.science - covid19.git/blobdiff - wikipedia/scripts/fetch_enwiki_daily_views.py
fix bugs with the date stamps
[covid19.git] / wikipedia / scripts / fetch_enwiki_daily_views.py
index c250bfe94aa23106bc900556b93e142860213532..225b06d7aaaa0135a78b75cbcdc7625dce5f366f 100755 (executable)
@@ -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:

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