fix bugs with the date stamps
This commit is contained in:
parent
061105b7b4
commit
06d2fd1563
@ -47,8 +47,6 @@ def main():
|
|||||||
yesterday = datetime.datetime.today() - datetime.timedelta(days=1)
|
yesterday = datetime.datetime.today() - datetime.timedelta(days=1)
|
||||||
queryDate = yesterday.strftime("%Y%m%d")
|
queryDate = yesterday.strftime("%Y%m%d")
|
||||||
|
|
||||||
queryDate = queryDate + "00" #requires specifying hours
|
|
||||||
|
|
||||||
#handle -L
|
#handle -L
|
||||||
loglevel_mapping = { 'debug' : logging.DEBUG,
|
loglevel_mapping = { 'debug' : logging.DEBUG,
|
||||||
'info' : logging.INFO,
|
'info' : logging.INFO,
|
||||||
@ -92,7 +90,7 @@ def main():
|
|||||||
#2 Repeatedly call the API with that list of names
|
#2 Repeatedly call the API with that list of names
|
||||||
for a in articleList:
|
for a in articleList:
|
||||||
a = a.strip("\"\n") #destringify
|
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)
|
response = requests.get(url)
|
||||||
if response.ok:
|
if response.ok:
|
||||||
|
@ -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)
|
yesterday = datetime.datetime.today() - datetime.timedelta(days=1)
|
||||||
query_date = yesterday.strftime("%Y%m%d")
|
query_date = yesterday.strftime("%Y%m%d")
|
||||||
|
|
||||||
query_data = query_date + "00" #requires specifying hours
|
|
||||||
|
|
||||||
#handle -L
|
#handle -L
|
||||||
loglevel_mapping = { 'debug' : logging.DEBUG,
|
loglevel_mapping = { 'debug' : logging.DEBUG,
|
||||||
'info' : logging.INFO,
|
'info' : logging.INFO,
|
||||||
@ -73,7 +71,7 @@ def main():
|
|||||||
logging.info(f"Last commit: {export_git_hash}")
|
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")
|
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")
|
api_session = api.Session("https://en.wikipedia.org/w/api.php")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user