0

I am trying to POST a multipart/base64 xml file to portal using the following in python. How can i run it in Python?

curl -X POST -H 'Accept: application/xml' -H 'Content-Type: multipart/related; boundary=<boundary_value_that_you_have>; type=text/xml; start=<cXML_Invoice_content_id>' --data-binary @<filename>.xml https://<customer_name>.host.com/cxml/invoices
David D
  • 31
  • 8

1 Answers1

0

You can use this website

I got this code. Could you try it ?

import requests

headers = {
    'Accept': 'application/xml',
    'Content-Type': 'multipart/related; boundary=<boundary_value_that_you_have>; type=text/xml; start=<cXML_Invoice_content_id>',
}

data = open('filename.xml', 'rb').read()

response = requests.post('https://<customer_name>.host.com/cxml/invoices', headers=headers, data=data)
Nabil
  • 1,130
  • 5
  • 11