Implement ILIAS auth and crawl home page

This commit introduces the necessary machinery to authenticate with
ILIAS and crawl the home page.

It can't do much yet and just silently fetches the homepage.
This commit is contained in:
I-Al-Istannen
2021-05-15 15:18:51 +02:00
committed by Joscha
parent 595de88d96
commit b2a2b5999b
4 changed files with 221 additions and 0 deletions

View File

@ -4,6 +4,8 @@ import functools
import getpass
from typing import Any, Callable, Optional, TypeVar
import bs4
T = TypeVar("T")
@ -23,6 +25,12 @@ async def ainput(prompt: str) -> str:
async def agetpass(prompt: str) -> str:
return await to_thread(lambda: getpass.getpass(prompt))
def soupify(data: bytes) -> bs4.BeautifulSoup:
"""
Parses HTML to a beautifulsoup object.
"""
return bs4.BeautifulSoup(data, "html.parser")
async def prompt_yes_no(query: str, default: Optional[bool]) -> bool:
"""