Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# and we make sure we don't forward it again to the Zulip stream.
not_from_zulip_bot = ('body' not in event['content'] or
event['sender'] != zulip_bot_user)
if not_from_zulip_bot and content:
try:
result = zulip_client.send_message({
"sender": zulip_client.email,
"type": "stream",
"to": zulip_config["stream"],
"subject": zulip_config["topic"],
"content": content,
})
except Exception as exception: # XXX This should be more specific
# Generally raised when user is forbidden
raise Bridge_ZulipFatalException(exception)
if result['result'] != 'success':
# Generally raised when API key is invalid
raise Bridge_ZulipFatalException(result['msg'])
if not_from_zulip_bot and content:
try:
result = zulip_client.send_message({
"sender": zulip_client.email,
"type": "stream",
"to": zulip_config["stream"],
"subject": zulip_config["topic"],
"content": content,
})
except Exception as exception: # XXX This should be more specific
# Generally raised when user is forbidden
raise Bridge_ZulipFatalException(exception)
if result['result'] != 'success':
# Generally raised when API key is invalid
raise Bridge_ZulipFatalException(result['msg'])