parameters: (self, options=None, eventHandler=None, eventDispatcher=None)
docstring: Create a consumer :class:`Session`.
  
          Args:
              options (SessionOptions): Options to construct the session with
              eventHandler (~collections.abc.Callable): Handler for events
                  generated by the session. Takes two arguments - received event
                  and related session
  
          Raises:
              InvalidArgumentException: If ``eventHandler`` is ``None`` and and
                  the ``eventDispatcher`` is not ``None``
  
          If ``eventHandler`` is not ``None`` then this :class:`Session` will
          operate in asynchronous mode, otherwise the :class:`Session` will
          operate in synchronous mode.
  
          If ``eventDispatcher`` is ``None`` then the :class:`Session` will
          create a default :class:`EventDispatcher` for this :class:`Session`
          which will use a single thread for dispatching events. For more control
          over event dispatching a specific instance of :class:`EventDispatcher`
          can be supplied. This can be used to share a single
          :class:`EventDispatcher` amongst multiple :class:`Session` objects.
  
          If an ``eventDispatcher`` is supplied which uses more than one thread
          the :class:`Session` will ensure that events which should be ordered
          are passed to callbacks in a correct order. For example, partial
          response to a request or updates to a single subscription.
  
          Each ``eventDispatcher`` uses it's own thread or pool of threads so if
          you want to ensure that a session which receives very large messages
          and takes a long time to process them does not delay a session that
          receives small messages and processes each one very quickly then give
          each one a separate ``eventDispatcher``.
  
          Note:
              In case of unhandled exception in ``eventHandler``, the exception
              traceback will be printed to ``sys.stderr`` and application will be
              terminated with nonzero exit code.
docstring_summary: Create a consumer :class:`Session`.
docstring_tokens: Create a consumer : class : Session .
function: def __init__(self, options=None, eventHandler=None, eventDispatcher=None):
          """Create a consumer :class:`Session`.
  
          Args:
              options (SessionOptions): Options to construct the session with
              eventHandler (~collections.abc.Callable): Handler for events
                  generated by the session. Takes two arguments - received event
                  and related session
  
          Raises:
              InvalidArgumentException: If ``eventHandler`` is ``None`` and and
                  the ``eventDispatcher`` is not ``None``
  
          If ``eventHandler`` is not ``None`` then this :class:`Session` will
          operate in asynchronous mode, otherwise the :class:`Session` will
          operate in synchronous mode.
  
          If ``eventDispatcher`` is ``None`` then the :class:`Session` will
          create a default :class:`EventDispatcher` for this :class:`Session`
          which will use a single thread for dispatching events. For more control
          over event dispatching a specific instance of :class:`EventDispatcher`
          can be supplied. This can be used to share a single
          :class:`EventDispatcher` amongst multiple :class:`Session` objects.
  
          If an ``eventDispatcher`` is supplied which uses more than one thread
          the :class:`Session` will ensure that events which should be ordered
          are passed to callbacks in a correct order. For example, partial
          response to a request or updates to a single subscription.
  
          Each ``eventDispatcher`` uses it's own thread or pool of threads so if
          you want to ensure that a session which receives very large messages
          and takes a long time to process them does not delay a session that
          receives small messages and processes each one very quickly then give
          each one a separate ``eventDispatcher``.
  
          Note:
              In case of unhandled exception in ``eventHandler``, the exception
              traceback will be printed to ``sys.stderr`` and application will be
              terminated with nonzero exit code.
          """
          if (eventHandler is None) and (eventDispatcher is not None):
              raise exception.InvalidArgumentException(
                  "eventDispatcher is specified but eventHandler is None", 0)
          if options is None:
              options = SessionOptions()
          if eventHandler is not None:
              self.__handler = eventHandler # pylint: disable=unused-private-member
              self.__handlerProxy = functools.partial(Session.__dispatchEvent,
                                                      weakref.ref(self))
          self.__handle = internals.Session_createHelper(
              get_handle(options),
              self.__handlerProxy,
              get_handle(eventDispatcher))
  
          _destroy = internals.Session_destroyHelper
          # note: AbstractSession destroy passes AbstractSession handle
          _dtor = lambda hndl: _destroy(self.__handle, self.__handlerProxy)
          atexit.register(self.stop) # we must stop session before shutdown
  
          AbstractSession.__init__(
              self,
              internals.blpapi_Session_getAbstractSession(self.__handle),
              _dtor)
function_tokens: def __init__ ( self , options = None , eventHandler = None , eventDispatcher = None ) : if ( eventHandler is None ) and ( eventDispatcher is not None ) : raise exception . InvalidArgumentException ( "eventDispatcher is specified but eventHandler is None" , 0 ) if options is None : options = SessionOptions ( ) if eventHandler is not None : self . __handler = eventHandler # pylint: disable=unused-private-member self . __handlerProxy = functools . partial ( Session . __dispatchEvent , weakref . ref ( self ) ) self . __handle = internals . Session_createHelper ( get_handle ( options ) , self . __handlerProxy , get_handle ( eventDispatcher ) ) _destroy = internals . Session_destroyHelper # note: AbstractSession destroy passes AbstractSession handle _dtor = lambda hndl : _destroy ( self . __handle , self . __handlerProxy ) atexit . register ( self . stop ) # we must stop session before shutdown AbstractSession . __init__ ( self , internals . blpapi_Session_getAbstractSession ( self . __handle ) , _dtor )