mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Fix ILIAS init.py and Pferd.py authenticators
This commit is contained in:
parent
83ea15ee83
commit
f47b137b59
@ -2,8 +2,7 @@
|
||||
Synchronizing files from ILIAS instances (https://www.ilias.de/).
|
||||
"""
|
||||
|
||||
from .authenticators import (IliasAuthenticator, KitShibbolethAuthenticator,
|
||||
KeyringKitShibbolethAuthenticator)
|
||||
from .authenticators import IliasAuthenticator, KitShibbolethAuthenticator
|
||||
from .crawler import (IliasCrawler, IliasCrawlerEntry, IliasDirectoryFilter,
|
||||
IliasElementType)
|
||||
from .downloader import (IliasDownloader, IliasDownloadInfo,
|
||||
|
@ -6,6 +6,7 @@ import logging
|
||||
from pathlib import Path
|
||||
from typing import Callable, List, Optional, Union
|
||||
|
||||
from .authenticators import UserPassAuthenticator
|
||||
from .cookie_jar import CookieJar
|
||||
from .diva import (DivaDownloader, DivaDownloadStrategy, DivaPlaylistCrawler,
|
||||
diva_download_new)
|
||||
@ -64,6 +65,13 @@ class Pferd(Location):
|
||||
for transformable in transformables:
|
||||
LOGGER.info(transformable.path)
|
||||
|
||||
@staticmethod
|
||||
def _get_authenticator(
|
||||
username: Optional[str], password: Optional[str]
|
||||
) -> KitShibbolethAuthenticator:
|
||||
inner_auth = UserPassAuthenticator("ILIAS - Pferd.py", username, password)
|
||||
return KitShibbolethAuthenticator(inner_auth)
|
||||
|
||||
def _ilias(
|
||||
self,
|
||||
target: PathLike,
|
||||
@ -150,7 +158,7 @@ class Pferd(Location):
|
||||
with overwriting or deleting files. The default always asks the user.
|
||||
"""
|
||||
# This authenticator only works with the KIT ilias instance.
|
||||
authenticator = KitShibbolethAuthenticator(username=username, password=password)
|
||||
authenticator = Pferd._get_authenticator(username=username, password=password)
|
||||
PRETTY.starting_synchronizer(target, "ILIAS", course_id)
|
||||
|
||||
organizer = self._ilias(
|
||||
@ -220,7 +228,7 @@ class Pferd(Location):
|
||||
with overwriting or deleting files. The default always asks the user.
|
||||
"""
|
||||
# This authenticator only works with the KIT ilias instance.
|
||||
authenticator = KitShibbolethAuthenticator(username=username, password=password)
|
||||
authenticator = Pferd._get_authenticator(username, password)
|
||||
PRETTY.starting_synchronizer(target, "ILIAS", "Personal Desktop")
|
||||
|
||||
organizer = self._ilias(
|
||||
@ -285,7 +293,7 @@ class Pferd(Location):
|
||||
with overwriting or deleting files. The default always asks the user.
|
||||
"""
|
||||
# This authenticator only works with the KIT ilias instance.
|
||||
authenticator = KitShibbolethAuthenticator(username=username, password=password)
|
||||
authenticator = Pferd._get_authenticator(username=username, password=password)
|
||||
PRETTY.starting_synchronizer(target, "ILIAS", "An ILIAS element by url")
|
||||
|
||||
if not full_url.startswith("https://ilias.studium.kit.edu"):
|
||||
|
Loading…
Reference in New Issue
Block a user