How to use the bugsnag.configuration.RequestConfiguration.get_instance function in bugsnag

To help you get started, we’ve selected a few bugsnag examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bugsnag / bugsnag-python / tests / test_path_encoding.py View on Github external
def test_path_supports_emoji(self):
        import bugsnag.wsgi.middleware

        environ = self.environ.copy()
        environ['PATH_INFO'] = '/😇'

        config = Configuration()
        notification = Notification(
            Exception("oops"),
            config,
            RequestConfiguration.get_instance()
        )

        bugsnag.configure_request(wsgi_environ=environ)

        bugsnag.wsgi.middleware.add_wsgi_request_data_to_notification(
            notification
        )

        # You can validate this by using "encodeURIComponent" in a browser.
        self.assertEqual(
            'http://localhost/%F0%9F%98%87',
            notification.meta_data['request']['url']
        )
github bugsnag / bugsnag-python / tests / test_path_encoding.py View on Github external
def test_path_supports_ascii_characters(self):
        import bugsnag.wsgi.middleware

        environ = self.environ.copy()
        environ['PATH_INFO'] = '/hello/world'

        bugsnag.configure_request(wsgi_environ=environ)

        config = Configuration()
        notification = Notification(
            Exception("oops"),
            config,
            RequestConfiguration.get_instance()
        )

        bugsnag.wsgi.middleware.add_wsgi_request_data_to_notification(
            notification
        )

        self.assertEqual(
            'http://localhost/hello/world',
            notification.meta_data['request']['url']
        )
github bugsnag / bugsnag-python / bugsnag / client.py View on Github external
def notify(self, exception, **options):
        """
        Notify bugsnag of an exception.

        >>> client.notify(Exception('Example'))
        """

        notification = Notification(exception, self.configuration,
                                    RequestConfiguration.get_instance(),
                                    **options)
        self.deliver(notification)
github bugsnag / bugsnag-python / bugsnag / legacy.py View on Github external
def add_metadata_tab(tab_name, data):
    """
    Add metaData to the tab

    bugsnag.add_metadata_tab("user", {"id": "1", "name": "Conrad"})
    """
    meta_data = RequestConfiguration.get_instance().meta_data
    if tab_name not in meta_data:
        meta_data[tab_name] = {}

    meta_data[tab_name].update(data)
github bugsnag / bugsnag-python / bugsnag / client.py View on Github external
def notify_exc_info(self, exc_type, exc_value, traceback, **options):
        """
        Notify bugsnag of an exception via exc_info.

        >>> client.notify_exc_info(*sys.exc_info())
        """

        exception = exc_value
        options['traceback'] = traceback
        notification = Notification(exception, self.configuration,
                                    RequestConfiguration.get_instance(),
                                    **options)
        self.deliver(notification)
github bugsnag / bugsnag-python / bugsnag / legacy.py View on Github external
def configure_request(**options):
    """
    Configure the Bugsnag notifier per-request settings.
    """
    RequestConfiguration.get_instance().configure(**options)