Try the script first on your page (specify Owner_id = None ). Then on the page of another user. As far as I remember, in groups of VK Owner_id they differ from the user & ndash; Their ID is written with a minus:
import vk_api import Sys Import radom # The script puts pictures on the wall of the user vk.com def vk_auth ( login, password ): vk = vk_apapi (login, password) try : vk.authorization () # authorized experept vk_api.authorizationerror as error_msg: : : : print (error_msg) # In the event of an error, we will display the message Sysit () retu vk login = '' ' password = ' '' owner_id = "" "" '' if __name__ == '' __ main __ ': # authorize vk = vk_auth (login, password) # list with links to pictures hrefs = [ 'https://danbour.donmai.us/data/sample/--Saber-nd-saber-alter-fate-stay-night-an D-Fate-Series-Drawn-by-Goldengear870-Sample-5C666A91632C80384FD9A1E8C43B5FD7.jpg ' ] random.shuffle (hrefs) # adding to the user wall # if you do not specify Owner_id, messages to yourself to the wall It fits for href in hrefs: rs = vk.method ( '' 'ipan>, { 'Owner_id' : Owner_id, 'message' : '' hey! ', ' Attachments' : href, }) print (RS) if the VK server did not pick up the picture and did not display it in the post, then it will be necessary to pour it on their server first. Here you need to use the methods: Photos.getwalluploadserver and Photos.savewallphoto
Example:
Def send_Method ( methad, data = none ): import logger Import time logger.debug ( 'Launching %S with these: %s. ', method, Data) rs = vk.method (Method, Data) logger.debug (' response: "" %s "', str (RS) .encode ()) time.sleep ( 0.5 ) retu rs # the way to picture file_name = ... rs = Send_MetHod ( 'Сotos.getwalluploadserver' ) upload_url = RS [ 'upload_url' ] rs = redists.post (upload_url, files = { 'epan ": open (File_name, 'rt' )}) rs = json.loads (rs.text) rs = send_method ( 'Сotos.savewallphoto' , { 'Photo' : rs [ 'photo' ], 'server' : 'server' ], 'hash' : rs [ 'hash' ]}}) # attachments in `vk.method ('posta> attachMens = 'Photo {} {}' . format (Owner_id, RS [ 0 ] [ 'Id' ])