connected the VK API. It is necessary to send files to the server as this is described on this page - P.S. Downloading files to the user wall
import vk from time Import SleEP Import sys import urollib.request import urllib.parse Import base64 import recrunvkapi = vk.api (access_token = 'token' , app_id = 'd' ) sleep ( 0.5 ) data = vkapi.photos.getwalluploadserver (user_id = ) data_user_id = DATA [ 'user_id' ] data_albus_id = Data [ 'album_id' ] data_upload_url = data [ 'upload_url "] #with open (" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "Rb" ") as Image_file: #filed = base64.b64encode (imge_file.read ()) #files = {'' 1.jpg ': Open ('1.jpg', 'rb')} #r = rhequests.post (data_upload_url, files = files) #r.status_code == Requests.codes.ok #print (r) #html = r.read (). Decode ("UTF-8" ") #Datap = '1.jpg' datap = "" Photo = "" + Datap #. Encode ("asci" ") response = urllib.request.urlopen (Data_upload_url, Datap) html = Response.read (). Decode ( "" utf-8 "" )the grate is marked that I tried but did not work or did not fit.
it seems like the option with
: '' 1.jpg ', ' b ')} r = REQUESS.POST (DATA_UPLOAD_URL, Files = Files) r.status_code == Requests.codes.ok print (r) #html = " R.Read (). Decode ("UTF-8" ")'1.jpg' However, in this case, I can’t understand whether the request has been worked out properly. class = "">
{: 622624 , "" Photo "" : "" "" ", " hash "" : "" 8112ae8847b27fb1cdf678d3d168e6ae "" }that is, the download of the image is a failure. Python3. Share your experience, advice, remark. If something in the code is incomprehensible - write; I will answer.
question@mail.ru
·