Y
Y
yhikaru2019-11-07 00:43:13
Python
yhikaru, 2019-11-07 00:43:13

How to manually send captcha to Vk_api in Python?

I am writing a simple program directly in the Python compiler, which must perform actions in real time. Gives error vk_api.exceptions.Captcha: Captcha needed. How to deal with it? Is it possible to enter captcha manually directly in the compiler or in some other way without using paid anti-captcha services? The program does not provide any links to the captcha. Here is the full text of the error:
Traceback (most recent call last):
File "C:/Users/Iya/Documents/Python/f.py", line 27, in
print(vk.wall.repost(object=a[i][ 2], group_id=a[i-2][1], publish_date=time2), a[i][0])
File "C:\Users\Ia\AppData\Local\Programs\Python\Python37-32\Lib \site-packages\vk_api\vk_api.py", line 681, in __call__
return self._vk.method(self._method, kwargs)
File "C:\Users\IA\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\vk_api\vk_api.py", line 641, in method
response = self.error_handlers[error.code]( error)
File "C:\Users\IA\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\vk_api\vk_api.py", line 523, in captcha_handler
raise captcha
vk_api.exceptions.Captcha: Captcha needed
Thank you in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Niriter Inc., 2019-11-07
@yhikaru

Select the server response, take the captcha_id [captcha_sid] and the link to the captcha image [captcha_img], display it in the console and wait for the response input. Follow the image link, type the result back into the console, and send the same request with only [captcha_sid] and [captcha_img]

import vk_api
import time

vk_session = vk_api.VkApi('+7**********', '********')
vk_session.auth()

vk = vk_session.get_api()
for i in range(10):
    try:
        if s_id and code:
             print(vk.wall.repost(object='wall-126227863_90727', captcha_sid=s_id, captcha_key=code))
             s_id = False
             code = False
        else:
             print(vk.wall.repost(object='wall-126227863_90727'))
    except vk_api.Captcha as e:
        s_id = e.sid
        print(e.url)
        code = input()
        i = i-1

M
Makssof, 2019-11-07
@makssof

https://vk.com/dev/captcha_error

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question