Kaynağa Gözat

Change interface of last_n_days

jherve 1 yıl önce
ebeveyn
işleme
46ee700271
1 değiştirilmiş dosya ile 4 ekleme ve 3 silme
  1. 4 3
      src/de_quoi_parle_le_monde/main.py

+ 4 - 3
src/de_quoi_parle_le_monde/main.py

@@ -16,10 +16,11 @@ class ArchiveDownloader:
     client: HttpClient
 
     @staticmethod
-    def last_n_days(n):
+    def last_n_days_at_hours(n: int, hours: list[int]) -> list[datetime]:
         return [
-            datetime.combine(date.today() - timedelta(days=i), time(hour=18))
+            datetime.combine(date.today() - timedelta(days=i), time(hour=h))
             for i in range(1, n)
+            for h in hours
         ]
 
     @staticmethod
@@ -59,7 +60,7 @@ class ArchiveDownloader:
 
 async def main(dler: ArchiveDownloader):
     storage = await Storage.create()
-    dts = ArchiveDownloader.last_n_days(10)
+    dts = ArchiveDownloader.last_n_days_at_hours(10, [18])
 
     async with dler.client.session() as session:
         ia = InternetArchiveClient(session)