You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def upload(self, filepath): filename = os.path.split(filepath)[-1] # prepare metadata 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?
The text was updated successfully, but these errors were encountered:
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 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?
The text was updated successfully, but these errors were encountered: