Creating and Posting XML with Python
Python
2021-10-10 09:45 (5 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 (No signup or login required)
Current rating: 1.0 (1)
Related posts
[Outdated] Using Selenium Remote (Selenium Grid) with browser_use
Obtain HttpOnly=True Session Cookies from Services Logged in via Browser-Use
Fix: Python 3.13 SSL error 'Basic Constraints of CA cert not marked critical' (VERIFY_X509_STRICT)
Template Code for Thread Parallelism and Process Parallelism in Python
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.
We look forward to discussing your development needs.