diff options
| author | 2025-08-16 07:00:40 -0400 | |
|---|---|---|
| committer | 2025-08-16 07:00:40 -0400 | |
| commit | 22e8d9823eb9fb802c926fb03a5fdccbea26f878 (patch) | |
| tree | d399937a3bf139d386b8f5df2fc646b751c14719 /gallery_dl/exception.py | |
| parent | 0839cde5064bd6000162ee23b8445b99afe10068 (diff) | |
| parent | 3d18761f620a294ea6c5bff13c5994b93b29f3ed (diff) | |
Update upstream source from tag 'upstream/1.30.3'
Update to upstream version '1.30.3'
with Debian dir cbd3490f51b0ee3f2e172965318cd079b856367d
Diffstat (limited to 'gallery_dl/exception.py')
| -rw-r--r-- | gallery_dl/exception.py | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/gallery_dl/exception.py b/gallery_dl/exception.py index 5a52581..6adda0d 100644 --- a/gallery_dl/exception.py +++ b/gallery_dl/exception.py @@ -100,12 +100,17 @@ class AuthorizationError(ExtractionError): class AuthRequired(AuthorizationError): default = "Account credentials required" - def __init__(self, required=None, message=None): - if required and not message: - if isinstance(required, str): - message = f"{required} required" + def __init__(self, auth=None, resource="resource", message=None): + if auth: + if not isinstance(auth, str): + auth = " or ".join(auth) + if " " not in resource: + resource = "this " + resource + if message is None: + message = (f"{auth} needed to access {resource}") else: - message = f"{' or '.join(required)} required" + message = (f"{auth} needed to access {resource} " + f"('{message}')") AuthorizationError.__init__(self, message) @@ -160,6 +165,22 @@ class ControlException(GalleryDLException): class StopExtraction(ControlException): """Stop data extraction""" + def __init__(self, target=None): + ControlException.__init__(self) + + if target is None: + self.target = None + self.depth = 1 + elif isinstance(target, int): + self.target = None + self.depth = target + elif target.isdecimal(): + self.target = None + self.depth = int(target) + else: + self.target = target + self.depth = 128 + class AbortExtraction(ExtractionError, ControlException): """Abort data extraction due to an error""" |
