youtube: Fix for HTTPError stub change.

https://github.com/python/typeshed/pull/10875

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-10-17 18:52:55 -07:00 committed by Anders Kaseorg
parent ccda105d1d
commit 8abca34a05

View file

@ -34,6 +34,7 @@ class YoutubeHandler:
try:
search_youtube("test", self.config_info["key"], self.config_info["video_region"])
except HTTPError as e:
assert e.response is not None
if e.response.json()["error"]["errors"][0]["reason"] == "keyInvalid":
bot_handler.quit(
"Invalid key." "Follow the instructions in doc.md for setting API key."