How to post multiple photos on facebook wall?

Greetings to all!
Third day trying to post a few pictures on the wall in facebook, in a network describe only post one pictures, have tried all methods, but the larger one does not fast, read that it is possible to post an album of photos I have looked through the documentation that the method is obsolete and the campaign is not supported, but perhaps I am mistaken, at least I tried it and nothing happened.
Found the solution in php its syntax does not understand, he tried it on the example to make, but odd in any way
Who dealt with fb or knows how to implement it? I would be very grateful for your help
July 5th 19 at 00:06
1 answer
July 5th 19 at 00:08
Solution
That's really my issue, as always it is much easier than you imagine)

# get a list of photo line is a direct reference of the type http://image.jpg
# you can also open the file in the usual way f = open('file_path', 'rb')
import requests

files = 'http://img.jpg, http://img1.jpg, http://img2.jpg, '
token = access_token # (token, user)

# pass function photo_id a list of files and our token
media = photo_id(file, token)
 # post on fb
 url = 'https://graph.facebook.com/me/feed?'
 data = {
 'access_token': user.fb_token,
 # can add links, video, files, etc.
}
 i = 0
 for id in media:
 # go through our list and create a dictionary
 data.update({'attached_media[%d]' % (i): '{"media_fbid": "%s"}' % (id)})
 i += 1
 resp = requests.post(url, data=data)


# the result is a list with id successfully uploaded photos 
def photo_id(files, token):
 images = files.split(',')
 media = []
 for img in images:
 url = 'https://graph.facebook.com/me/photos?published=false'
 data = dict(access_token=token, url=img)
 resp = requests.post(url, data)
 res = json.loads(resp.text)['id']
media.append(res)
 return media

Find more questions by tags FacebookPython