def generate_payload(self, config, context):
        """
        Generate payload by checking Flask request object.
        :param context: current context.
        :param config: honeybadger configuration.
        :return: a dict with the generated payload.
        """
        from flask import current_app, session, request as _request

        current_view = current_app.view_functions[_request.endpoint]
        if hasattr(current_view, 'view_class'):
            component = '.'.join((current_view.__module__, current_view.view_class.__name__))
        else:
            component = current_view.__module__
        cgi_data = {
            k: v
            for k, v in iteritems(_request.headers)
        }
        cgi_data.update({
            'REQUEST_METHOD': _request.method
        })
        payload = {
            'url': _request.base_url,
            'component': component,
            'action': _request.endpoint,
            'params': {},
            'session': filter_dict(dict(session), config.params_filters),
            'cgi_data': cgi_data,
            'context': context
        }

        # Add query params
        params = filter_dict(dict(_request.args), config.params_filters)
        params.update(filter_dict(dict(_request.form), config.params_filters))

        payload['params'] = params

        return payload
Generate payload by checking Flask request object.
        :param context: current context.
        :param config: honeybadger configuration.
        :return: a dict with the generated payload.