mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Allow specifying paths as strings in Pferd
This commit is contained in:
parent
4c0e3b493a
commit
4e7333b396
@ -4,7 +4,7 @@ Convenience functions for using PFERD.
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional, Union
|
||||||
|
|
||||||
from .cookie_jar import CookieJar
|
from .cookie_jar import CookieJar
|
||||||
from .ilias import (IliasAuthenticator, IliasCrawler, IliasDirectoryFilter,
|
from .ilias import (IliasAuthenticator, IliasCrawler, IliasDirectoryFilter,
|
||||||
@ -38,7 +38,7 @@ class Pferd(Location):
|
|||||||
|
|
||||||
def _ilias(
|
def _ilias(
|
||||||
self,
|
self,
|
||||||
target: Path,
|
target: Union[Path, str],
|
||||||
base_url: str,
|
base_url: str,
|
||||||
course_id: str,
|
course_id: str,
|
||||||
authenticator: IliasAuthenticator,
|
authenticator: IliasAuthenticator,
|
||||||
@ -51,7 +51,7 @@ class Pferd(Location):
|
|||||||
cookie_jar = CookieJar(cookies)
|
cookie_jar = CookieJar(cookies)
|
||||||
session = cookie_jar.create_session()
|
session = cookie_jar.create_session()
|
||||||
tmp_dir = self._tmp_dir.new_subdir()
|
tmp_dir = self._tmp_dir.new_subdir()
|
||||||
organizer = Organizer(self.resolve(target))
|
organizer = Organizer(self.resolve(Path(target)))
|
||||||
|
|
||||||
crawler = IliasCrawler(base_url, course_id, session, authenticator, dir_filter)
|
crawler = IliasCrawler(base_url, course_id, session, authenticator, dir_filter)
|
||||||
downloader = IliasDownloader(tmp_dir, organizer, session, authenticator)
|
downloader = IliasDownloader(tmp_dir, organizer, session, authenticator)
|
||||||
@ -69,7 +69,7 @@ class Pferd(Location):
|
|||||||
|
|
||||||
def ilias_kit(
|
def ilias_kit(
|
||||||
self,
|
self,
|
||||||
target: Path,
|
target: Union[Path, str],
|
||||||
course_id: str,
|
course_id: str,
|
||||||
dir_filter: IliasDirectoryFilter = lambda x: True,
|
dir_filter: IliasDirectoryFilter = lambda x: True,
|
||||||
transform: Transform = lambda x: x,
|
transform: Transform = lambda x: x,
|
||||||
|
@ -4,7 +4,7 @@ A few utility bobs and bits.
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
from pathlib import Path, PurePath
|
from pathlib import Path, PurePath
|
||||||
from typing import Optional, Tuple
|
from typing import Optional, Tuple, Union
|
||||||
|
|
||||||
import bs4
|
import bs4
|
||||||
import requests
|
import requests
|
||||||
@ -123,7 +123,7 @@ class PrettyLogger:
|
|||||||
|
|
||||||
def starting_synchronizer(
|
def starting_synchronizer(
|
||||||
self,
|
self,
|
||||||
target_directory: Path,
|
target_directory: Union[Path, str],
|
||||||
synchronizer_name: str,
|
synchronizer_name: str,
|
||||||
subject: Optional[str] = None,
|
subject: Optional[str] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user