headers = {'X-Requested-With': 'urllib2', 'Content-Type': 'application/xml',
    'Authorization': 'Basic %s' % base64string}
req = urllib.request.Request(url=url, data=request_data, headers=headers)
response = urllib.request.urlopen(req, timeout=int(TIMEOUT))
xml_output = response.read()
How to POST an xml element in python