Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'http': config.proxy_host
})
opener = build_opener(proxies)
else:
opener = build_opener()
resp = opener.open(req)
status = resp.getcode()
if 'success' in options:
success = options['success']
else:
success = 200
if status != success:
bugsnag.logger.warning(
'Delivery to %s failed, status %d' % (uri, status))
def send_payload():
if notification.api_key is None:
bugsnag.logger.warning(
"No API key configured, couldn't notify")
return
if initial_severity != notification.severity:
notification.severity_reason = {
'type': 'userCallbackSetSeverity'
}
else:
notification.severity_reason = initial_reason
payload = notification._payload()
try:
self.configuration.delivery.deliver(self.configuration,
payload)
except Exception as e:
bugsnag.logger.exception('Notifying Bugsnag failed %s', e)
# Trigger session delivery
self.session_tracker.send_sessions()
if 'severity' in options:
options['severity_reason'] = {'type': 'userSpecifiedSeverity'}
else:
options['severity_reason'] = {'type': 'handledException'}
if (isinstance(exception, (list, tuple)) and len(exception) == 3 and
isinstance(exception[2], types.TracebackType)):
default_client.notify_exc_info(*exception, **options)
else:
if not isinstance(exception, BaseException):
try:
value = repr(exception)
except Exception:
value = '[BADENCODING]'
bugsnag.logger.warning('Coercing invalid notify()'
' value to RuntimeError: %s' % value)
exception = RuntimeError(value)
default_client.notify(exception, **options)
if config.proxy_host:
req_options['proxies'] = {
'https': config.proxy_host,
'http': config.proxy_host
}
response = requests.post(uri, **req_options)
status = response.status_code
if 'success' in options:
success = options['success']
else:
success = requests.codes.ok
if status != success:
bugsnag.logger.warning(
'Delivery to %s failed, status %d' % (uri, status))