Rename Ilias-specific stuff

This commit is contained in:
Joscha 2018-11-23 10:09:03 +00:00
parent 5d5f60e21f
commit 2afcd38f1c
3 changed files with 9 additions and 6 deletions

View File

@ -10,7 +10,7 @@ from .ReadWriteLock import ReadWriteLock
__all__ = [ __all__ = [
"OutOfTriesException", "OutOfTriesException",
"UnknownFileType", "UnknownFileTypeException",
"ShibbolethAuthenticator", "ShibbolethAuthenticator",
] ]
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -18,7 +18,7 @@ logger = logging.getLogger(__name__)
class OutOfTriesException(Exception): class OutOfTriesException(Exception):
pass pass
class UnknownFileType(Exception): class UnknownFileTypeException(Exception):
pass pass
class ShibbolethAuthenticator: class ShibbolethAuthenticator:
@ -196,7 +196,7 @@ class ShibbolethAuthenticator:
return False return False
else: else:
# What *did* we get? # What *did* we get?
raise UnknownFileType(f"Unknown file of type {resp.content_type}.") raise UnknownFileTypeException(f"Unknown file of type {resp.content_type}.")
except aiohttp.client_exceptions.ServerDisconnectedError: except aiohttp.client_exceptions.ServerDisconnectedError:
logger.debug(f"Try {t+1} out of {self.RETRY_ATTEMPTS} failed, retrying in {self.RETRY_DELAY} s") logger.debug(f"Try {t+1} out of {self.RETRY_ATTEMPTS} failed, retrying in {self.RETRY_DELAY} s")

View File

@ -1,8 +1,8 @@
from .authenticator import * from .IliasAuthenticators import *
from .organizer import * from .organizer import *
__all__ = ( __all__ = (
authenticator.__all__ + IliasAuthenticators.__all__ +
organizer.__all__ organizer.__all__
) )

View File

@ -19,10 +19,13 @@ async def test_download():
orga.clean_temp_dir() orga.clean_temp_dir()
filename = orga.temp_file() filename = orga.temp_file()
print(filename)
await auth.download_file("file_886544_download", filename) await auth.download_file("file_886544_download", filename)
orga.add_file(filename, pathlib.Path("test.pdf")) orga.add_file(filename, pathlib.Path("test.pdf"))
filename = orga.temp_file()
await auth.download_file("file_886544_download", filename)
orga.add_file(filename, pathlib.Path("bla/test2.pdf"))
orga.clean_sync_dir() orga.clean_sync_dir()
orga.clean_temp_dir() orga.clean_temp_dir()
await auth.close() await auth.close()