Universal Messaging 10.5 | Developer Guide | Enterprise APIs | Enterprise Developer's Guide for Python | Enterprise Client Development | Creating a Session
 
Creating a Session
To interact with a Universal Messaging Server, the first thing to do is initialize a Universal Messaging Session object, which is effectively your logical and physical connection to one or more Universal Messaging Realms.
Creating a Universal Messaging Session Object
A Universal Messaging Session object (called NirvanaSession) is contained within the NirvanaPython library so you must first include the library and then initiate a new NirvanaSession.

from NirvanaPython import *
NirvanaModule = NirvanaSession()
If the NirvanaPython library is not in the same directory as the application you are writing then you will need to make sure the directory containing the library is in the Python sys path:

import sys
sys.path.append('..\\bin\\Win32\\Python26\\')
If you have problems importing the NirvanaPython library then it may be that one of the other dependencies are missing. Please make sure you have dealt with the prerequisites (see Environment Configuration)
Connecting to a Universal Messaging Realm
Once the NirvanaSession object has been initialised, you can connect to a Universal Messaging Realm as follows:

rname="nsp://localhost:9000"
NirvanaModule.connect(rname)
For information of the parameters you can pass to the connect() function e.g a user name, you can enter:

help(NirvanaModule.connect)