Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zeep parser produces dictionary keys that don't exist in raw XML #1414

Open
aleksejs-fomins opened this issue Apr 12, 2024 · 0 comments
Open

Comments

@aleksejs-fomins
Copy link

aleksejs-fomins commented Apr 12, 2024

Hi, I'm new to Zeep, and I am updating some legacy code that is using it. I have found that the parsed Zeep dictionaries differ significantly from the raw XML response. Unfortunately, I cannot post the data here because it is sensitive. But I can post the code

I use the following to obtain the raw XML and the parsed data, by changing the raw_response flag.

    client = zeep.Client(wsdl)
    with client.settings(strict=False, raw_response=raw_response):
        ret = client.service.read(query)

For raw response, I extract ret.content.

For parsed response, I convert everything to dictionaries via

    dict(zeep.helpers.serialize_object(ret, target_cls=dict))

The raw response contains ~20 fields, all filled with some meaningfull data.
The parsed response also contains those ~20 fields, but on top of that contains another ~40 fields that are not in the raw XML response, and for all of which the value is None, or sometimes an empty list. The names of those fields are meaningful, and likely appear somewhere else in the API. But it would be desired for the parsed output to match the XML exactly if possible.

I would appreciate some help in understanding where those fields are coming from, and how I could make the parsed response more consistent with the XML.

@aleksejs-fomins aleksejs-fomins changed the title Zeep produces too many fields Zeep parser produces dictionary keys that don't exist in raw XML Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant