@vante_scribaxxi

Python requests, почему вк апи выдает Access dinied на photos.getWallUploadServer?

Код ошибки
{"error":{"error_code":15,"error_msg":"Access denied: no access to call this method","request_params":[{"key":"oauth","value":"1"},{"key":"method","value":"photos.getWallUploadServer"},{"key":"group_id","value":"60116316"},{"key":"v","value":"5.73"}]}}

Код скрипта
img = {'photo': open(photos[0], 'rb')}

url = 'https://api.vk.com/method/photos.getWallUploadServer?group_id='+ gid +'&v=5.73&access_token=тут_токен'
response = requests.get(url)
result = json.loads(response.text)
print(result)
upload_url = result['response']['upload_url']

response = requests.post(upload_url, files=img)
result = json.loads(response.text)

method_url = 'https://api.vk.com/method/photos.saveWallPhoto?'
data = dict(access_token=token, group_id=gid, photo=result['photo'], hash=result['hash'], server=result['server'], v="5.73")
response = requests.post(method_url, data)
result = json.loads(response.text)['response'][0]['id']

method_url = 'https://api.vk.com/method/wall.post?'
data = dict(access_token=token, owner_id='-' + gid, attachments=result, message='', v="5.73")
response = requests.post(method_url, data)
result = json.loads(response.text)


scope=messages,wall,photos,groups,friends
app_id=2890984
  • Вопрос задан
  • 154 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы