pageviews: N’utilise pas les données du jour présent
This commit is contained in:
		
							parent
							
								
									1767738167
								
							
						
					
					
						commit
						9734bb401f
					
				| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
import collections
 | 
					import collections
 | 
				
			||||||
from datetime import datetime
 | 
					from datetime import datetime, timedelta
 | 
				
			||||||
from .http import session
 | 
					from .http import session
 | 
				
			||||||
import numpy
 | 
					import numpy
 | 
				
			||||||
from scipy import stats
 | 
					from scipy import stats
 | 
				
			||||||
| 
						 | 
					@ -27,6 +27,9 @@ pageviews_date_format = '%Y%m%d'
 | 
				
			||||||
# Date de première disponibilité des pageviews sur l’API Wikimedia
 | 
					# Date de première disponibilité des pageviews sur l’API Wikimedia
 | 
				
			||||||
pageviews_first_data = datetime(2015, 7, 1)
 | 
					pageviews_first_data = datetime(2015, 7, 1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Date de dernière disponibilité des pageviews sur l’API Wikimedia
 | 
				
			||||||
 | 
					pageviews_last_data = datetime.today() - timedelta(days=1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Tableau contenant tous les jours de l’année de 1 à 365
 | 
					# Tableau contenant tous les jours de l’année de 1 à 365
 | 
				
			||||||
year_all_days = numpy.arange(1, 366)
 | 
					year_all_days = numpy.arange(1, 366)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -88,7 +91,7 @@ def get_aggregate(project):
 | 
				
			||||||
        agent='user',
 | 
					        agent='user',
 | 
				
			||||||
        granularity='daily',
 | 
					        granularity='daily',
 | 
				
			||||||
        start=pageviews_first_data.strftime(pageviews_date_format),
 | 
					        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()
 | 
					    data = res.json()
 | 
				
			||||||
| 
						 | 
					@ -124,7 +127,7 @@ def get_article(project, article):
 | 
				
			||||||
        agent='user',
 | 
					        agent='user',
 | 
				
			||||||
        granularity='daily',
 | 
					        granularity='daily',
 | 
				
			||||||
        start=pageviews_first_data.strftime(pageviews_date_format),
 | 
					        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()
 | 
					    data = res.json()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue