mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Store modification_date in IliasDownloadInfo, remove parameters
This commit is contained in:
parent
23bed48c8c
commit
b2a7af2e3e
@ -1,5 +1,6 @@
|
|||||||
"""Contains a downloader for ILIAS."""
|
"""Contains a downloader for ILIAS."""
|
||||||
|
|
||||||
|
import datetime
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
@ -25,7 +26,8 @@ class IliasDownloadInfo:
|
|||||||
|
|
||||||
path: Path
|
path: Path
|
||||||
url: str
|
url: str
|
||||||
parameters: Dict[str, Any] = field(default_factory=dict)
|
modification_date: datetime.datetime
|
||||||
|
# parameters: Dict[str, Any] = field(default_factory=dict)
|
||||||
|
|
||||||
|
|
||||||
class IliasDownloader:
|
class IliasDownloader:
|
||||||
@ -61,7 +63,7 @@ class IliasDownloader:
|
|||||||
self._organizer.accept_file(tmp_file, info.path)
|
self._organizer.accept_file(tmp_file, info.path)
|
||||||
|
|
||||||
def _try_download(self, info: IliasDownloadInfo, target: Path) -> bool:
|
def _try_download(self, info: IliasDownloadInfo, target: Path) -> bool:
|
||||||
with self._session.get(info.url, params=info.parameters, stream=True) as response:
|
with self._session.get(info.url, stream=True) as response:
|
||||||
content_type = response.headers["content-type"]
|
content_type = response.headers["content-type"]
|
||||||
|
|
||||||
if content_type.startswith("text/html"):
|
if content_type.startswith("text/html"):
|
||||||
|
Loading…
Reference in New Issue
Block a user