Feb 12, 2013

openSUSE Forums: Python web services (SOAP) with Suds module help

openSUSE Forums
openSUSE Forums
Python web services (SOAP) with Suds module help
Feb 12th 2013, 15:45



import logging
import suds
from suds.wsse import *
import sys
import readline

url = "http://firescopetest:8048/services/FireScopeConfigurationWebService/v1?wsdl"
token = UsernameToken("webservices", "password")
security = Security()

client = suds.client.Client(url)
client.set_options(wsse = security)

def ci():

        ci = raw_input("Enter your CI name: ")
        ip = raw_input("Enter the IP address of your CI: ")
        ci = ci.strip()
        ip = ip.strip()
        response = client.service.createConfigurationItems(ci, "MONITOR", True, ip)
        print "Done!"

def template():

        template = raw_input("Enter your template name: ")
        ci = raw_input("Enter your CI name: ")
        template = template.strip()
        ci = ci.strip()
        response = client.service.linkTemplate(template, ci, "CREATE_OR_UPDATE")
        print "Done!"

print "What would you like to do\n1. Create a new CI?\n2. Link a CI to Template?"

answer = raw_input()

if answer == "1":
elif answer == "2":
    print "Wrong answer try again"

I am creating a short script to automate creation in our monitoring platform Firescope.

In this script i want to be able to create some variables with user input and use them in the suds client service. Does anybody have experience with python and suds. The variables appear not be passing through correctly even after being converted to strings with strip. Its only the first function ci that is not working the template function is working fine. So the variables are being passed through there. But the IP variable in the first function is number this could be causing problems....? Im no web services expert this is my first time using them.

PDF version of Firescope webservices - Linky

Any help with this would be great.


You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

No comments: