Hi everyone. I'm new enough to web2py so please be gentle! :)

I'm just involved in a small college project at the moment where we've
had an existing python script monitoring a number of nodes and
returning the results in the python GUI. I'm just moving onto trying
to integrate the project into a web2py web framework environment (I've
started today)

I'm currently reading through the manual but having difficulty getting
different pieces to work.

I wish to use the Win32 com module to integrate the functionality of
the ping command within my python script below. I'd apreciate it if
someone could guide me as how to integrate this script within a web
environment..

1) Is it as simple as importing setup.py into my project in Web2py
from the win32 folder I extracted off source forge?

2) Do I have to change any parameters, at all?

Any other help would be much apreciated! Script is below.. Thanks!


import win32com.client

wmi = win32com.client.GetObject(r"winmgmts:\\.\root\cimv2")

def Ping(host):
    col_items = wmi.ExecQuery("Select * from Win32_PingStatus Where
Address = '%s'" % host)
    for item in col_items:
        if item.StatusCode == 0:
# success
            print "Host ", item.Address
            print "Recorded Hops: ", item.RecordRoute
            print "Buffer Size: ", item.ReplySize
            print "Response Time: ", item.ResponseTime
            print "ResponseTimeToLive: ", item.ResponseTimeToLive
            print "Timeout: ", item.Timeout
            print "TimetoLive: ", item.TimetoLive

# ping node
Ping('192.168.1.3')

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to