XML Response Issues
katelivi opened this issue · 1 comments
Hi,
I have been able to authenticate to OpenAir, as denoted in the XML response by "<response><Auth status = "0"></Auth ></response>" I receive. When I am generating the 'xml_commands' variable for the request, I am needing to make the list of attributes I am requesting for a dictionary given that '.get()' is called on this attributes list in the 'Read' method.
orderby = {'id':"", 'name':"", 'budget':"", 'budget_time':"", 'rate': ""}
xml_commands = commands.Read('Project', 'all', {'limit': '1000'}, [], orderby)
Results in: xml_res = "<response><Auth status = "0"></Auth ></response>"
To my understanding, this requested project information should be in between the “Auth” tags of the response. Why might this not be happening? Does this have to do with the orderby dictionary? Or maybe the way I am requesting this information from OpenAir? If you could please let me know, that would be great.
Thank you in advance!
@katelivi I'm not sure I'm following your example so you might have to include a code example for the full request you're trying to generate. From what I can infer above, you are returning an instance of a Read
object in xml_commands
rather than returning a bytestring
- this is because you are not calling .read()
on the commands.Read
object. Given the structure of the API, OpenAir expects an XML string as the payload (and not a Python object).
You should be able to follow the example in the README or docs to show how you can pass the output of the Read
into the payload for the HTTP request.
orderby = {'id':"", 'name':"", 'budget':"", 'budget_time':"", 'rate': ""}
xml_data = []
xml_data.append(commands.Read('Project', 'all', {'limit': '1000'}, [], orderby).read())
xml_req = connections.Request(app, auth, xml_data).tostring()