K
K
Kirkyles2017-08-27 17:30:31
Python
Kirkyles, 2017-08-27 17:30:31

What to do Python Vk api request not working?

import vk
import json
import time

user_password='*********'
user_login='*********'
app_id='*********'

session=vk.AuthSession(app_id=app_id,user_login=user_login,user_password=user_password,scope='messages')
api =vk.API(session)




chat_id= 26
print("Начало работы")
print("Захожу в беседу")
print("Добавляю тебя в беседу")
r = api.messages.addChatUser(chat_id=chat_id,user_id=242352092)
time.sleep(1)
if r!=1:
    print("Ошибка,не удалось тебя добавить в беседу")
    api.messages.removeChatUser(chat_id=chat_id,user_id=381887204)
    print("Вышел из беседы")
else:
    api.messages.removeChatUser(chat_id=chat_id, user_id=381887204)
    print("Вышел из беседы")

Is this the kind of mistake I have to make?
tried to write an antikick from the conversation
Traceback (most recent call last):
  File "C:/Users/kirill/Desktop/Божеские разаработки на Python/Антикик из беседы/main.py", line 19, in <module>
    r = api.messages.addChatUser(chat_id=chat_id,user_id=242352092)
  File "C:\Users\kirill\AppData\Local\Programs\Python\Python36-32\lib\site-packages\vk\api.py", line 173, in __call__
    return self._api._session.make_request(self)
  File "C:\Users\kirill\AppData\Local\Programs\Python\Python36-32\lib\site-packages\vk\api.py", line 102, in make_request
    raise error
vk.exceptions.VkAPIError: 10. Internal server error. request_params = {'oauth': '1', 'method': 'messages.addChatUser', 'chat_id': '26', 'user_id': '242352092'}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Serezha, 2017-08-27
Ahen @Ahen

Obviously, the user is not an administrator of the conversation. If you are excluded from the conversation, then you will not be able to return to it yourself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question