In general, I took the code, inserted my data into it and then tried to run it. It seems the data is correct and gives an error.

This code is for uploading photos to the VKontakte group:

import vk_api def main(): login, password = '+7999******', '***********' vk_session = vk_api.VkApi(login, password) try: vk_session.authorization() except vk_api.AuthorizationError as error_msg: print(error_msg) return """ В VkUpload реализованы методы загрузки файлов в ВК. (Не все, если что-то понадобится - могу дописать) """ upload = vk_api.VkUpload(vk_session) photo = upload.photo( # Подставьте свои данные 'C:\Program Files (x86)\images', album_id=147060453, group_id=245815717 ) vk_photo_url = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQJ4trx_zWOPt7l-tvBiM5RJrcdBQtgd-_zTRv4LmmnleHV-UYl1w'.format( photo[0]['-147060453'], photo[0]['1'] ) print(photo, '\nLink: ', vk_photo_url) if __name__ == '__main__': main() 

Mistake:

 Warning (from warnings module): File "C:\Users\Roman\AppData\Local\Programs\Python\Python35-32\lib\site-packages\vk_api\vk_api.py", line 137 DeprecationWarning DeprecationWarning: Please replace `VkApi.authorization` with `VkApi.auth` and `AuthorizationError` with `AuthError` Traceback (most recent call last): File "C:\Users\Roman\Desktop\VK API.py", line 35, in <module> main() File "C:\Users\Roman\Desktop\VK API.py", line 25, in main group_id=245815717 File "C:\Users\Roman\AppData\Local\Programs\Python\Python35-32\lib\site-packages\vk_api\upload.py", line 45, in photo url = self.vk.method('photos.getUploadServer', values)['upload_url'] File "C:\Users\Roman\AppData\Local\Programs\Python\Python35-32\lib\site-packages\vk_api\vk_api.py", line 450, in method raise error vk_api.exceptions.ApiError: [200] Access denied 
  • Instead of a link to a picture with an error, it is better to correct the question and add the problem code and error text (stack path ) to it - gil9red
  • Well, here's the error: vk_api.exceptions.ApiError: [200] Access denied occurs in VkUpload. Another way to 'C:\Program Files (x86)\images' must have escaping slashes, otherwise after will swear on the wrong path - gil9red
  • Please note that in the message DeprecationWarning: Please replace VkApi.authorization with VkApi.auth and AuthorizationError with AuthError are asked to replace VkApi.authorization with VkApi.auth and AuthorizationError with AuthError and access will be allowed - Anton Kulago

0