Upload images gallery to wordpress with python-wordpress-xmlrpc -
okay have created script in python using "python-wordpress-xmlrpc" package able except uploading multiple images wordpress , adding them gallery.
here code upload single image file , set feature image:
fileimg = urlopen('image_url') imagename = fileimg.url.split('/')[-1] imagetype = mimetypes.guess_type(str(fileimg.url))[0] data = { 'name': imagename, 'type': imagetype, } data['bits'] = xmlrpc_client.binary(fileimg.read()) response = client.call(media.uploadfile(data)) attachment_id = response['id'] widget.thumbnail = attachment_id
note: know how upload multiple files don't understand how add images in product gallery.
Comments
Post a Comment