T
T
tarased2020-05-01 20:07:44
Python
tarased, 2020-05-01 20:07:44

Vk_api python - how to enter captcha from the console, and also not log in every time the program starts?

Hello. Not so long ago I started working in Python, and a little later I started working with vk_api. The essence of the application lies in the fact that VK accounts spam comments / likes and so on, in general - the usual cheat to increase the coverage of the record. I ran into two problems that I haven't been able to solve yet, namely:
1. vk_api.exceptions.Captcha
How can I enter a captcha from the console so that I don't get a new one each time? (that is, I enter a captcha, but it still gives me the same, only a new one). I tried to solve the problem in different ways, worked with the vk_api documentation, but without result. For example, my code currently looks like this:
try:
action
except vk_api.Captcha as e:
key = key = input("Enter captcha code {0}: ".format(e.get_url())).strip()
e.try_again(key)

I enter the captcha, but, as I said earlier, there is no sense in it . If this problem cannot be solved locally, then how can I work with captcha using websites (I heard about this, but I could not find it either)?
2.The second problem is that every time you start the program, you have to log into VK accounts on a new one. To describe the problem more specifically, I don’t know how to make it so that I can log in from the console one time (maybe pass the method somewhere) and on subsequent launches of the program, just do some actions from an existing session. I tried to write the method (.get_api()) into txt/bin - it didn’t work either, because I didn’t figure it out, since writing is only through the .write() method. Code so far:
vk_session = vk_api.VkApi(login, password)
vk_session.auth()
session = vk_session.get_api()

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