Please see the sample Python code in the STAF Python User's Guide at 
http://staf.sourceforge.net/current/STAFPython.htm.

For example (copied from this document), here is a Python 2.x example of a 
Python script that registers with STAF, submits a couple of STAF service 
requests, and then unregisters with STAF.

    from PySTAF import *
    import sys

    try:
        handle = STAFHandle("MyTest")
    except STAFException, e:
        print "Error registering with STAF, RC: %d" % e.rc
        sys.exit(e.rc)

    result = handle.submit("local", "ping", "ping")

    if (result.rc != 0):
        print "Error submitting request, RC: %d, Result: %s" % (result.rc, 
result.result)

    result = handle.submit("local", "var", "resolve string 
{STAF/Config/OS/Name}")

    if (result.rc != 0):
        print "Error submitting request, RC: %d, Result: %s" % (result.rc, 
result.result)
    else:
        print "OS Name: %s" % result.result

    rc = handle.unregister()

    sys.exit(rc)

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:   santosh hs <santosh.tron...@gmail.com>
To:     Sharon Lucas/Austin/IBM@IBMUS
Cc:     staf-users@lists.sourceforge.net
Date:   07/06/2011 12:25 PM
Subject:        Re: [staf-users] Getting Started with STAF



i went through the STAF document but didn't actually get as how can i use 
this in my automation, so could please plz give me sample codes as how 
this is used in automation using python.
suppose i have python script whcih send a reques to server and gets the 
response, so how can i use staf in this case.
i very new to STAF so please provide me some sample code other than the 
one which is available in http://staf.sourceforge.net/current/docs.php.
OR please could you please tell me where can i get the sample python 
scripts wit STAF


/san

On Wed, Jul 6, 2011 at 8:57 PM, Sharon Lucas <luc...@us.ibm.com> wrote:
Did you check out the "Getting Started with STAF" guide available via 
http://staf.sourceforge.net/current/docs.php ? 

If you want to submit STAF service requests via a Python program, then 
also check out the "STAF Python User's Guide" via 
http://staf.sourceforge.net/current/docs.php.  It includes sample code on 
how to submit STAF service requests via a Python program.

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:        santosh hs <santosh.tron...@gmail.com> 
To:        staf-users@lists.sourceforge.net 
Date:        07/04/2011 01:32 PM 
Subject:        [staf-users] Getting Started with STAF 



Hi All,
I am very new to STAF,i want to use STAF in Automation in Python.
please let me know how to get started,i went thru the STAF documents.
please give me some sample codes as how can i introduce STAF in 
automation.

/san 
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to