Beispiel #1
0
    def createWithUserAndApp(cls, user, appName):
        """Create an :class:`AuthOptions` instance for User and Application
        Mode.

        Args:
            user (AuthUser): user-specific authorization option.
            appName (str): app name used for Application Mode.

        Returns:
            AuthOptions: an :class:`AuthOptions` that contains the
            authorization option for the User+Application authorization
            mode.

        The behavior is undefined when ``appName`` is ``None`` or ``""``.
        """
        app_handle = AuthOptions._create_app_handle(appName)
        retcode, authOptions_handle = internals \
            .blpapi_AuthOptions_create_forUserAndAppMode(get_handle(user),
                                                         app_handle)
        _ExceptionUtil.raiseOnError(retcode)
        return cls(authOptions_handle, app_handle=app_handle)
Beispiel #2
0
def getAdminMessageDefinition(messageName):
    """ Return the definition for an admin message of the specified
    ``messageName``.

    Args:
        messageName (Name or str): The name of the desired admin message.

    Returns:
        SchemaElementDefinition: The element definition for the message
        specified by ``messageName``.

    Raises:
        Exception: If ``messageName`` does not name an admin message.
    """
    if isstr(messageName):
        messageName = Name(conv2str(messageName))
    rc, schema_element_definition_handle = \
        internals.blpapi_TestUtil_getAdminMessageDefinition(
            get_handle(messageName))
    _ExceptionUtil.raiseOnError(rc)
    schema_definition = \
        SchemaElementDefinition(schema_element_definition_handle, sessions=None)
    return schema_definition
 def _appendValueStr(self, value):
     """ Dispatch method for appending string types. """
     _ExceptionUtil.raiseOnError(
         internals.blpapi_MessageFormatter_appendValueString(
             self.__handle, conv2str(value)))
 def _(self, value):
     """ Dispatch method for appending `Name` types. """
     _ExceptionUtil.raiseOnError(
         internals.blpapi_MessageFormatter_appendValueFromName(
             self.__handle, get_handle(value)))
 def _(self, value):
     """ Dispatch method for appending `float` types. """
     _ExceptionUtil.raiseOnError(
         internals.blpapi_MessageFormatter_appendValueFloat(
             self.__handle, value))
 def _(self, value):
     """ Dispatch method for appending time types. """
     _ExceptionUtil.raiseOnError(
         internals.blpapi_MessageFormatter_appendValueHighPrecisionDatetime(
             self.__handle, _DatetimeUtil.convertToBlpapi(value)))
 def _setElementStr(self, name, value):
     """ Dispatch method for setting string types. """
     _ExceptionUtil.raiseOnError(
         internals.blpapi_MessageFormatter_setValueString(
             self.__handle, get_handle(name), conv2str(value)))
 def _(self, name, _):
     """ Dispatch method for setting `None` types. """
     _ExceptionUtil.raiseOnError(
         internals.blpapi_MessageFormatter_setValueNull(
             self.__handle, get_handle(name)))
 def _(self, name, value):
     """ Dispatch method for setting `float` types. """
     _ExceptionUtil.raiseOnError(
         internals.blpapi_MessageFormatter_setValueFloat(
             self.__handle, get_handle(name), value))
 def _(self, name, value):
     """ Dispatch method for setting time types. """
     _ExceptionUtil.raiseOnError(
         internals.blpapi_MessageFormatter_setValueHighPrecisionDatetime(
             self.__handle, get_handle(name),
             _DatetimeUtil.convertToBlpapi(value)))
Beispiel #11
0
 def _create_token_handle(token):
     """For internal use only."""
     retcode, token_handle = internals \
         .blpapi_AuthToken_create(token)
     _ExceptionUtil.raiseOnError(retcode)
     return token_handle
Beispiel #12
0
 def _create_app_handle(appName):
     """For internal use only."""
     retcode, app_handle = internals \
         .blpapi_AuthApplication_create(appName)
     _ExceptionUtil.raiseOnError(retcode)
     return app_handle