pageviews: N’utilise pas les données du jour présent

This commit is contained in:
Mattéo Delabre 2019-12-04 21:05:18 -05:00
parent 1767738167
commit 9734bb401f
Signed by: matteo
GPG Key ID: AE3FBD02DC583ABB
1 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import collections
from datetime import datetime
from datetime import datetime, timedelta
from .http import session
import numpy
from scipy import stats
@ -27,6 +27,9 @@ pageviews_date_format = '%Y%m%d'
# Date de première disponibilité des pageviews sur lAPI Wikimedia
pageviews_first_data = datetime(2015, 7, 1)
# Date de dernière disponibilité des pageviews sur lAPI Wikimedia
pageviews_last_data = datetime.today() - timedelta(days=1)
# Tableau contenant tous les jours de lannée de 1 à 365
year_all_days = numpy.arange(1, 366)
@ -88,7 +91,7 @@ def get_aggregate(project):
agent='user',
granularity='daily',
start=pageviews_first_data.strftime(pageviews_date_format),
end=datetime.today().strftime(pageviews_date_format)
end=pageviews_last_data.strftime(pageviews_date_format)
))
data = res.json()
@ -124,7 +127,7 @@ def get_article(project, article):
agent='user',
granularity='daily',
start=pageviews_first_data.strftime(pageviews_date_format),
end=datetime.today().strftime(pageviews_date_format)
end=pageviews_last_data.strftime(pageviews_date_format)
))
data = res.json()