Creating and Posting XML with Python
Python
2021-10-10 09:45 (4 years ago)

Create and Post XML with Python
from xml.etree import ElementTreerequest_xml = ElementTree.Element('request') update_request = ElementTree.SubElement( request_xml, 'itemUpdateRequest') item = ElementTree.SubElement(update_request, 'item') ElementTree.SubElement(item, 'itemUrl').text = itemUrl
for key, value in updateData.items():
ElementTree.SubElement(item, key).text = valueresponse = self.request( '/es/1.0/item/update', method='post', headers={'Content-Type': 'application/xml'}, data=ElementTree.tostring( request_xml, encoding='utf-8', xml_declaration=True) )
Please rate this article
Current rating: 1.0 (1)
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.
We look forward to discussing your development needs.