Closed hograthm closed 8 years ago
The get_captcha_key
is a part of BaseAuthAPI
sub-classes which are part of VKSession
namely VKSession.AUTH_API_CLS
class variable.
To override the method you need:
BaseAuthAPI
, implement your getting captcha logic thereVKSession
with a new AUTH_API_CLS
valueclass MyAuthAPI(BaseAuthAPI):
def get_captcha_key(self):
# do something
class MyVKSession(VKSession):
AUTH_API_CLS = MyAuthAPI
# Copied from create_api method
session = MyVKSession(app_id, login, password, phone_number=phone_number,
scope=scope, api_version=api_version)
api = API(session=session, timeout=timeout, **method_default_args)
Well, I see that it's a bit hassle to do it and adding auth_api_cls
as an instance parameter would be reasonable. I will think about it
Thanks a lot.
I'm new to Python and do not quite understand how I have to reload this method in my code to handle captcha. It would be nice to see an example.