data = {
'name': filename,
'type': mimetypes.guess_type(filepath)[0], # mimetype
}
# read the binary file and let the XMLRPC library encode it into base64
with open(filepath, 'rb') as img:
data['bits'] = xmlrpc_client.Binary(img.read())
response = self.client.call(media.UploadFile(data))
# print (response)
return response`
it upload well, but the file name has changed.
the source file name is : graffiti1-c1063fa88b70424e95fe0bec6a222674-kaips.com.jpg
it changed to be: 'graffiti1-c1063fa88b70424e95fe0bec6a222674-kaips.com.jpg'
it added at last , why?
How can i use my own filename?
filepath = 'D:\APP_MY\TOOLS_MY\crawler\vars\download\wp-content/uploads/2020/07\graffiti1-c1063fa88b70424e95fe0bec6a222674-kaips.com.jpg'
` def upload(self, filepath): filename = os.path.split(filepath)[-1]
prepare metadata
it upload well, but the file name has changed. the source file name is : graffiti1-c1063fa88b70424e95fe0bec6a222674-kaips.com.jpg it changed to be: 'graffiti1-c1063fa88b70424e95fe0bec6a222674-kaips.com.jpg' it added at last , why? How can i use my own filename?