<s> AUTHORIZATION_FAILED = <NUM_LIT:5> <EOL> PERMISSION_IS_DENIED = <NUM_LIT:7> <EOL> CAPTCHA_IS_NEEDED = <NUM_LIT> <EOL> ACCESS_DENIED = <NUM_LIT:15> <EOL> INVALID_USER_ID = <NUM_LIT> <EOL> class VkException ( Exception ) : <EOL> pass <EOL> class VkAuthError ( VkException ) : <EOL> pass <EOL> class VkAPIError ( VkException ) : <EOL> __slots__ = [ '<STR_LIT:error>' , '<STR_LIT:code>' , '<STR_LIT:message>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> CAPTCHA_NEEDED = <NUM_LIT> <EOL> ACCESS_DENIED = <NUM_LIT:15> <EOL> def __init__ ( self , error_data ) : <EOL> super ( VkAPIError , self ) . __init__ ( ) <EOL> self . error_data = error_data <EOL> self . code = error_data . get ( '<STR_LIT>' ) <EOL> self . message = error_data . get ( '<STR_LIT>' ) <EOL> self . request_params = self . get_pretty_request_params ( error_data ) <EOL> self . redirect_uri = error_data . get ( '<STR_LIT>' ) <EOL> @ staticmethod <EOL> def get_pretty_request_params ( error_data ) : <EOL> request_params = error_data . get ( '<STR_LIT>' , ( ) ) <EOL> request_params = { param [ '<STR_LIT:key>' ] : param [ '<STR_LIT:value>' ] for param in request_params } <EOL> return request_params <EOL> def is_access_token_incorrect ( self ) : <EOL> return self . code == self . ACCESS_DENIED and '<STR_LIT>' in self . message <EOL> def is_captcha_needed ( self ) : <EOL> return self . code == self . CAPTCHA_NEEDED <EOL> @ property <EOL> def captcha_sid ( self ) : <EOL> return self . error_data . get ( '<STR_LIT>' ) <EOL> @ property <EOL> def captcha_img ( self ) : <EOL> return self . error_data . get ( '<STR_LIT>' ) <EOL> def __str__ ( self ) : <EOL> error_message = '<STR_LIT>' . format ( self = self ) <EOL> if self . redirect_uri : <EOL> error_message += '<STR_LIT>' . format ( self = self ) <EOL> return error_message </s>
