python: Catch specific exceptions from requests.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-10-08 18:32:34 -07:00
committed by Tim Abbott
parent 17ac17286c
commit 7f69c1d3d5
4 changed files with 12 additions and 12 deletions

View File

@@ -190,16 +190,16 @@ def join_bigbluebutton(request: HttpRequest, meeting_id: str = REQ(validator=che
if settings.BIG_BLUE_BUTTON_URL is None or settings.BIG_BLUE_BUTTON_SECRET is None:
return json_error(_("Big Blue Button is not configured."))
else:
response = requests.get(
add_query_to_redirect_url(settings.BIG_BLUE_BUTTON_URL + "api/create", urlencode({
"meetingID": meeting_id,
"moderatorPW": password,
"attendeePW": password + "a",
"checksum": checksum
})))
try:
response = requests.get(
add_query_to_redirect_url(settings.BIG_BLUE_BUTTON_URL + "api/create", urlencode({
"meetingID": meeting_id,
"moderatorPW": password,
"attendeePW": password + "a",
"checksum": checksum
})))
response.raise_for_status()
except Exception:
except requests.RequestException:
return json_error(_("Error connecting to the Big Blue Button server."))
payload = ElementTree.fromstring(response.text)