mirror of
https://github.com/Garmelon/PFERD.git
synced 2026-04-13 07:55:05 +02:00
merge master
This commit is contained in:
commit
024aceb5ee
3 changed files with 14 additions and 13 deletions
|
|
@ -37,7 +37,7 @@ Ensure that you have at least Python 3.8 installed.
|
||||||
To install PFERD or update your installation to the latest version, run this
|
To install PFERD or update your installation to the latest version, run this
|
||||||
wherever you want to install or have already installed PFERD:
|
wherever you want to install or have already installed PFERD:
|
||||||
```
|
```
|
||||||
$ pip install git+https://github.com/Garmelon/PFERD@v2.6.1
|
$ pip install git+https://github.com/Garmelon/PFERD@v2.6.2
|
||||||
```
|
```
|
||||||
|
|
||||||
The use of [venv] is recommended.
|
The use of [venv] is recommended.
|
||||||
|
|
@ -60,8 +60,8 @@ $ mkdir Vorlesungen
|
||||||
$ cd Vorlesungen
|
$ cd Vorlesungen
|
||||||
$ python3 -m venv .venv
|
$ python3 -m venv .venv
|
||||||
$ source .venv/bin/activate
|
$ source .venv/bin/activate
|
||||||
$ pip install git+https://github.com/Garmelon/PFERD@v2.6.1
|
$ pip install git+https://github.com/Garmelon/PFERD@v2.6.2
|
||||||
$ curl -O https://raw.githubusercontent.com/Garmelon/PFERD/v2.6.1/example_config.py
|
$ curl -O https://raw.githubusercontent.com/Garmelon/PFERD/v2.6.2/example_config.py
|
||||||
$ python3 example_config.py
|
$ python3 example_config.py
|
||||||
$ deactivate
|
$ deactivate
|
||||||
```
|
```
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -2,7 +2,7 @@ from setuptools import find_packages, setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="PFERD",
|
name="PFERD",
|
||||||
version="2.6.1",
|
version="2.6.2",
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"httpx>=0.17.1",
|
"httpx>=0.17.1",
|
||||||
|
|
|
||||||
19
sync_url.py
19
sync_url.py
|
|
@ -27,9 +27,10 @@ _LOGGER = logging.getLogger("sync_url")
|
||||||
_PRETTY = PrettyLogger(_LOGGER)
|
_PRETTY = PrettyLogger(_LOGGER)
|
||||||
|
|
||||||
|
|
||||||
def _extract_credentials(file_path: Optional[str]) -> UserPassAuthenticator:
|
def _extract_credentials(file_path: Optional[str],
|
||||||
|
username: Optional[str], password: Optional[str]) -> UserPassAuthenticator:
|
||||||
if not file_path:
|
if not file_path:
|
||||||
return UserPassAuthenticator("KIT ILIAS Shibboleth", None, None)
|
return UserPassAuthenticator("KIT ILIAS Shibboleth", username, password)
|
||||||
|
|
||||||
if not Path(file_path).exists():
|
if not Path(file_path).exists():
|
||||||
_PRETTY.error("Credential file does not exist")
|
_PRETTY.error("Credential file does not exist")
|
||||||
|
|
@ -101,7 +102,7 @@ def main() -> None:
|
||||||
"KIT ILIAS Shibboleth", username=args.username, password=args.password
|
"KIT ILIAS Shibboleth", username=args.username, password=args.password
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
inner_auth = _extract_credentials(args.credential_file)
|
inner_auth = _extract_credentials(args.credential_file, args.username, args.password)
|
||||||
|
|
||||||
username, password = inner_auth.get_credentials()
|
username, password = inner_auth.get_credentials()
|
||||||
authenticator = KitShibbolethAuthenticator(inner_auth)
|
authenticator = KitShibbolethAuthenticator(inner_auth)
|
||||||
|
|
@ -137,13 +138,13 @@ def main() -> None:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if args.local_first:
|
if args.local_first:
|
||||||
file_confilict_resolver: FileConflictResolver = _resolve_local_first
|
file_conflict_resolver: FileConflictResolver = _resolve_local_first
|
||||||
elif args.no_delete:
|
elif args.no_delete:
|
||||||
file_confilict_resolver = _resolve_no_delete
|
file_conflict_resolver = _resolve_no_delete
|
||||||
elif args.remote_first:
|
elif args.remote_first:
|
||||||
file_confilict_resolver = _resolve_remote_first
|
file_conflict_resolver = _resolve_remote_first
|
||||||
else:
|
else:
|
||||||
file_confilict_resolver = resolve_prompt_user
|
file_conflict_resolver = resolve_prompt_user
|
||||||
|
|
||||||
pferd.enable_logging()
|
pferd.enable_logging()
|
||||||
|
|
||||||
|
|
@ -153,14 +154,14 @@ def main() -> None:
|
||||||
dir_filter=dir_filter,
|
dir_filter=dir_filter,
|
||||||
cookies=args.cookies,
|
cookies=args.cookies,
|
||||||
username=username,
|
username=username,
|
||||||
password=password,
|
password=password
|
||||||
)
|
)
|
||||||
|
|
||||||
pferd.add_ilias_folder(
|
pferd.add_ilias_folder(
|
||||||
ilias=ilias,
|
ilias=ilias,
|
||||||
target=target,
|
target=target,
|
||||||
full_url=args.url,
|
full_url=args.url,
|
||||||
file_conflict_resolver=file_confilict_resolver,
|
file_conflict_resolver=file_conflict_resolver,
|
||||||
transform=sanitize_windows_path
|
transform=sanitize_windows_path
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue