python - Sending multipart data with rauth / requests -
I am developing an API-client to transfer real estate. The provided interface is using Oauth1 and multipart HTTP posting to upload attachment data. Service Provider wants to have an uploaded attachment in a specific format as mentioned here: (section example for photo ) What do I basically do to create a MIME Multilateral Post for
- An XML document
- A binary file
So far, I have the rauth
, resp file logic Tried to use To distribute both the request
, the XML and the binary file. But I can not figure out how to add different MIME types (such as App / XML and Image / JPG) to different Multipart sections. How can I do this
like this:?
import request files = {'attachment': ('filename.jpg', open ('path / / filename.jpg', 'rb'), 'image / jpeg; name = Filename.jpg ',' content-transfer-encoding ':' binary '}),' metadata ': (' body.xml ', open (' / path / to / body.xml ',' rb '),' Application / xml; name = body.xml ', {' content-transfer-encoding ':' binary '})}} response = request. Post (url, files = files)
Comments
Post a Comment