def from_headers(self, headers):
        """Generate a SpanContext object using the trace context header.

        :type headers: dict
        :param headers: HTTP request headers.

        :rtype: :class:`~opencensus.trace.span_context.SpanContext`
        :returns: SpanContext generated from the trace context header.
        """
        if headers is None:
            return SpanContext()
        header = headers.get(_TRACE_CONTEXT_HEADER_NAME)
        if header is None:
            return SpanContext()
        header = str(header.encode('utf-8'))
        return self.from_header(header)
def from_headers ( self , headers ) : if headers is None : return SpanContext ( ) header = headers . get ( _TRACE_CONTEXT_HEADER_NAME ) if header is None : return SpanContext ( ) header = str ( header . encode ( 'utf-8' ) ) return self . from_header ( header )
Generate a SpanContext object using the trace context header.

        :type headers: dict
        :param headers: HTTP request headers.

        :rtype: :class:`~opencensus.trace.span_context.SpanContext`
        :returns: SpanContext generated from the trace context header.