Skip to content

Commit 6a0bee4

Browse files
committed
Fix crash on triggering assertions
1 parent 71af8c0 commit 6a0bee4

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

vk_api/vk_api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,11 @@ def twofactor(self, response, code):
193193
:param reponse: запрос, содержащий страницу с приглашением к аутентификации
194194
:param code: код, который необходимо ввести для успешной аутентификации
195195
"""
196-
assert code != None, "Empty code doesn't acceptable"
197-
assert len(code) == 6, "Length of code cannot be other than 6."
196+
197+
if code == None:
198+
raise TwoFactorError("Empty code doesn't acceptable")
199+
if len(code) != 6:
200+
raise TwoFactorError("Length of code cannot be other than 6.")
198201

199202
auth_hash = search_re(RE_AUTH_HASH, response.text)
200203
url = 'https://vk.com/al_login.php'

0 commit comments

Comments
 (0)