11# -*- coding: utf-8 -*-
22"""
3- @author: Kirill Python
3+ @author: python273
44@contact: https://vk.com/python273
55@license Apache License, Version 2.0, see LICENSE file
66
@@ -23,10 +23,6 @@ class AuthError(VkApiError):
2323 pass
2424
2525
26- class AuthorizationError (AuthError ): # todo: delete
27- pass
28-
29-
3026class LoginRequired (AuthError ):
3127 pass
3228
@@ -48,6 +44,7 @@ class TwoFactorError(AuthError):
4844
4945
5046class SecurityCheck (AuthError ):
47+
5148 def __init__ (self , phone_prefix = None , phone_postfix = None , response = None ):
5249 self .phone_prefix = phone_prefix
5350 self .phone_postfix = phone_postfix
@@ -59,11 +56,12 @@ def __str__(self):
5956 self .phone_prefix , self .phone_postfix
6057 )
6158 else :
62- return ('Security check. Phone prefix and postfix not detected. '
63- 'Please send bugreport. Response in self.response' )
59+ return ('Security check. Phone prefix and postfix are not detected.'
60+ ' Please send bugreport (response in self.response) ' )
6461
6562
6663class ApiError (VkApiError ):
64+
6765 def __init__ (self , vk , method , values , error ):
6866 self .vk = vk
6967 self .method = method
@@ -72,9 +70,7 @@ def __init__(self, vk, method, values, error):
7270 self .error = error
7371
7472 def try_method (self ):
75- """ Пробует отправить запрос заново
76-
77- """
73+ """ Отправить запрос заново """
7874
7975 return self .vk .method (self .method , self .values )
8076
@@ -84,16 +80,15 @@ def __str__(self):
8480
8581
8682class ApiHttpError (VkApiError ):
83+
8784 def __init__ (self , vk , method , values , response ):
8885 self .vk = vk
8986 self .method = method
9087 self .values = values
9188 self .response = response
9289
9390 def try_method (self ):
94- """ Пробует отправить запрос заново
95-
96- """
91+ """ Отправить запрос заново """
9792
9893 return self .vk .method (self .method , self .values )
9994
@@ -102,6 +97,7 @@ def __str__(self):
10297
10398
10499class Captcha (VkApiError ):
100+
105101 def __init__ (self , vk , captcha_sid , func , args = None , kwargs = None , url = None ):
106102 self .vk = vk
107103 self .sid = captcha_sid
@@ -116,28 +112,25 @@ def __init__(self, vk, captcha_sid, func, args=None, kwargs=None, url=None):
116112 self .image = None
117113
118114 def get_url (self ):
119- """ Возвращает ссылку на изображение капчи
120-
121- """
115+ """ Получить ссылку на изображение капчи """
122116
123117 if not self .url :
124118 self .url = 'https://api.vk.com/captcha.php?sid={}' .format (self .sid )
125119
126120 return self .url
127121
128122 def get_image (self ):
129- """ Возвращает бинарное изображение капчи, получаемое по get_url()
130- """
123+ """ Получить изображение капчи (jpg) """
131124
132125 if not self .image :
133126 self .image = self .vk .http .get (self .get_url ()).content
134127
135128 return self .image
136129
137- def try_again (self , key ):
138- """ Отправляет запрос заново с ответом капчи
130+ def try_again (self , key = None ):
131+ """ Отправить запрос заново с ответом капчи
139132
140- :param key: текст капчи
133+ :param key: ответ капчи
141134 """
142135
143136 if key :
0 commit comments