Answer the question
In order to leave comments, you need to log in
Error vk_api.exceptions.ApiError: [100] One of the parameters specified was missing or invalid: message is empty or invalid?
import vk_api
import time
token = "5843245b181ae990161384ba1e0008bd13e5b5fe993d51"
user_id = 1
vk = vk_api.VkApi(token=token).get_api()
f = open("tt.txt", "rt", encoding="utf8")
def captcha_handler(captcha):
key = input("Enter captcha code {0}: ".format(captcha.get_url())).strip()
return captcha.try_again(key)
while True:
try:
line = f.read()
time.sleep(1)
vk.messages.send(
chat_id=51,
message=line,
random_id=0
)
f.seek(0)
except vk_api.exceptions.Captcha as captcha:
captcha_handler(captcha)
Answer the question
In order to leave comments, you need to log in
Make sure before calling the method that the line passed to it as the message parameter is not empty.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question