0

I have a SOAP response which I am trying to parse with ElementTree

    doc = ET.parse(response_xml)
    for cust in doc.findall('.//{http://www.starstandards.org/webservices/2005/10/transport}Content'):
        custnumber = cust.findtext('{http://www.starstandards.org/webservices/2005/10/transport}CustomerNumber')
        custfname = cust.findtext('{http://www.starstandards.org/webservices/2005/10/transport}FirstName')
        custlname = cust.findtext('{http://www.starstandards.org/webservices/2005/10/transport}LastName')
    return custnumber, custfname, custlname  

I am trying to get the information out of the response and I keep getting the following error:

No such file or directory

Does the response_xml need to be saved to a file before I can parse it? Why can't I just use it from memory?

1 Answer 1

1

ET.parse() needs a file name. You might want to try ET.fromstring() instead.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.