INNER CODE UNIT · Python

get_correlation_id_in_request_context

bobbui/json-logging-python · json_logging/framework/connexion/__init__.py:181

    def get_correlation_id_in_request_context(self, request):
        if _is_async_request(request):
            return getattr(request.state, 'correlation_id', None)
        try:
            return _connexion.g.get('correlation_id', None)
        except:
            return None

    def get_protocol(self, request):
        if _is_async_request(request):
            http_version = request.scope.get('http_version')
            return 'HTTP/' + http_version if http_version else json_logging.EMPTY_VALUE
        return request.environ.get('SERVER_PROTOCOL')

    def get_path(self, request):
        if _is_async_request(request):
            return request.url.path
        return request.path

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…