I am trying to port a perl app to python and i dont have much
experience with python.
I need to strip the leading and trailing whitespaces from a http post
result:

def sms_sender(a):
    query_args = { 'username':username,
                   'password':password,
                   'to':'001234567890',
                   'from':'001234567890',
                   'text':a }
    encoded_args = urllib.urlencode(query_args)
    url = 'https://myaccount.smsdiscount.com/clx/sendsms.php'
    #print urllib.urlopen(url, encoded_args).read()
    response = urlfetch.fetch(url=url,
                        payload=encoded_args,
                        method=urlfetch.POST,
                        headers={'Content-Type': 'application/x-www-
form-urlencoded'})
    response = response.strip()
    root = ET.fromstring(response)
    #Create an iterator
    iter = root.getiterator()
    #Iterate
    for element in iter:
        if element.text:
            text = element.text
            if element.tag == "result":
                ResultCode = repr(text)
            elif element.tag == "resultstring":
                ResultString = repr(text)
            elif element.tag == "resultdescription":
                ResultDescription = repr(text)
            elif element.tag == "endcause":
                ResultEndCause = repr(text)

I know the code is horrible!
I get the error:

AttributeError: '_URLFetchResult' object has no attribute 'strip'

I really dont know how to proceed!! Please help..

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to