K
K
kpronink2015-03-15 09:22:15
Python
kpronink, 2015-03-15 09:22:15

A request to the VK API with the captcha_key parameters returns another captcha, what's wrong?

Hello, I send the actual request with the groups.join method, after a certain number of repetitions of this request, it returns a captcha. I send this request again but with the sid and key parameters, and it returns the captcha again. Tell me what I'm doing wrong.

def join_group(id_group, group_name, capcha_sid, capcha_key):

    if capcha_sid == '':
        url_for_join = "https://api.vkontakte.ru/method/" \
                       "groups.join?group_id=" + str(id_group) +\
                       "&access_token=" + access_token
    else:
        url_for_join = "https://api.vkontakte.ru/method/" \
                       "groups.join?group_id=" + str(id_group) +\
                       "&captcha_sid=" + capcha_sid +\
                       "&captcha_key=" + capcha_key +\
                       "&access_token=" + access_token

    response = requests.get(url_for_join)

    is_response, sleep, code_error, error_msg = check_response(response)

    if is_response:
        join = json.loads(response.text)['response']
        print('Вступили в группу (' + group_name + ')' + '(' + str(id_group) + ')')
    else:
        join = json.loads(response.text)['error']
        print(error_msg)
        if code_error == 14:
            print(join['captcha_img'])
            capcha_key = input('Введите код с капчи ')
            capcha_sid = join['captcha_sid']
            join_group(id_group, group_name, capcha_sid, capcha_key)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question