(self, context)
return "{0} - Capability '{1}' called by user {2} from app {3}".format(peer, capability, userId, appId)
Retreive useful information for the function call.
        :param context: context
        :return: string containing header info
Retreive useful information for the function call.
        :param context: context
        :return: string containing header info
Retreive useful information for the function call . : param context : context : return : string containing header info
def _get_call_info(self, context):
        """
        Retreive useful information for the function call.
        :param context: context
        :return: string containing header info
        """

        # Get metadata for the call from the context
        metadata = dict(context.invocation_metadata())
        
        # Get the function ID
        func_header = SSE.FunctionRequestHeader()
        func_header.ParseFromString(metadata['qlik-functionrequestheader-bin'])
        func_id = func_header.functionId

        # Get the common request header
        common_header = SSE.CommonRequestHeader()
        common_header.ParseFromString(metadata['qlik-commonrequestheader-bin'])

        # Get capabilities
        if not hasattr(self, 'capabilities'):
            self.capabilities = self.GetCapabilities(None, context, log=False)

        # Get the name of the capability called in the function
        capability = [function.name for function in self.capabilities.functions if function.functionId == func_id][0]
                
        # Get the user ID using a regular expression
        match = re.match(r"UserDirectory=(?P<UserDirectory>\w*)\W+UserId=(?P<UserId>\w*)", common_header.userId, re.IGNORECASE)
        if match:
            userId = match.group('UserDirectory') + '/' + match.group('UserId')
        else:
            userId = common_header.userId
        
        # Get the app ID
        appId = common_header.appId
        # Get the call's origin
        peer = context.peer()

        return "{0} - Capability '{1}' called by user {2} from app {3}".format(peer, capability, userId, appId)
def _get_call_info ( self , context ) : # Get metadata for the call from the context metadata = dict ( context . invocation_metadata ( ) ) # Get the function ID func_header = SSE . FunctionRequestHeader ( ) func_header . ParseFromString ( metadata [ 'qlik-functionrequestheader-bin' ] ) func_id = func_header . functionId # Get the common request header common_header = SSE . CommonRequestHeader ( ) common_header . ParseFromString ( metadata [ 'qlik-commonrequestheader-bin' ] ) # Get capabilities if not hasattr ( self , 'capabilities' ) : self . capabilities = self . GetCapabilities ( None , context , log = False ) # Get the name of the capability called in the function capability = [ function . name for function in self . capabilities . functions if function . functionId == func_id ] [ 0 ] # Get the user ID using a regular expression match = re . match ( r"UserDirectory=(?P<UserDirectory>\w*)\W+UserId=(?P<UserId>\w*)" , common_header . userId , re . IGNORECASE ) if match : userId = match . group ( 'UserDirectory' ) + '/' + match . group ( 'UserId' ) else : userId = common_header . userId # Get the app ID appId = common_header . appId # Get the call's origin peer = context . peer ( ) return "{0} - Capability '{1}' called by user {2} from app {3}" . format ( peer , capability , userId , appId )