diff options
| author | 2025-08-25 02:01:07 -0400 | |
|---|---|---|
| committer | 2025-08-25 02:01:07 -0400 | |
| commit | 1df55d9de48105dace9cc16f1511dba3c9a6da6f (patch) | |
| tree | 6f6af90bd15a453d7fd1f5253cf01e1db801222f /gallery_dl/extractor/oauth.py | |
| parent | 3c1539bde1b47fff0ba81c9d92801fa700fedc3b (diff) | |
New upstream version 1.30.5.upstream/1.30.5
Diffstat (limited to 'gallery_dl/extractor/oauth.py')
| -rw-r--r-- | gallery_dl/extractor/oauth.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/gallery_dl/extractor/oauth.py b/gallery_dl/extractor/oauth.py index 2d9a061..ff192c2 100644 --- a/gallery_dl/extractor/oauth.py +++ b/gallery_dl/extractor/oauth.py @@ -60,9 +60,23 @@ class OAuthBase(Extractor): pass server.close() - data = self.client.recv(1024).decode() - path = data.split(" ", 2)[1] - return text.parse_query(path.partition("?")[2]) + data = None + try: + data = self.client.recv(1024).decode() + path = data.split(" ", 2)[1] + return text.parse_query(path.partition("?")[2]) + except Exception as exc: + if data is None: + msg = "Failed to receive" + elif not data: + exc = "" + msg = "Received empty" + else: + self.log.warning("Response: %r", data) + msg = "Received invalid" + if exc: + exc = f" ({exc.__class__.__name__}: {exc})" + raise exception.AbortExtraction(f"{msg} OAuth response{exc}") def send(self, msg): """Send 'msg' to the socket opened in 'recv()'""" |
