На данный момент скрипт отправляет только одно изображение.
import requests import json token = "token" group_id = 1 h ='тест' text = 'магия!!!' def getWallUploadServer(): r = requests.get('https://api.vk.com/method/photos.getWallUploadServer?', params = {'access_token':token, 'group_id':group_id, 'v':'5.101'}).json() return r['response']['upload_url'] def save_r(): save_result = requests.get('https://api.vk.com/method/photos.saveWallPhoto?', params ={'access_token':token, 'group_id':group_id, 'caption': h, 'photo':upload_response['photo'], 'server':upload_response['server'], 'hash':upload_response['hash'], 'v':'5.101'}).json() return ('photo'+str(save_result['response'][0]['owner_id'])+'_'+str(save_result['response'][0]['id'])+'&access_key='+str(save_result['response'][0]['access_key'])) def main(): upload_url = getWallUploadServer() file = {'file1': open('123.jpg', 'rb') } global upload_response upload_response = requests.post(upload_url, files=file).json() save_result = save_r() result2 = requests.get('https://api.vk.com/method/wall.post?', params ={'attachments':save_result, 'owner_id':-group_id, 'message': text, 'access_token':token, 'from_group': '1', 'v':'5.101'}).json() if __name__ == '__main__': main()