Try it. First, you must upload all the photos and save the identifier (imgs_id).
Then create a dict as args and finally call the request method.
Sorry if not the best compressed code ...
imgs_id = [] for img in img_list: photo = open(img, "rb") imgs_id.append(api.put_photo(photo, album_id='me/photos',published=False)['id']) photo.close() args=dict() args["message"]="Put your message here" for img_id in imgs_id: key="attached_media["+str(imgs_id.index(img_id))+"]" args[key]="{'media_fbid': '"+img_id+"'}" api.request(path='/me/feed', args=None, post_args=args, method='POST')
source share