#NEWLINE# def _check_result( self , response , result ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# error = result . get ( 'error' , None ) #NEWLINE# reason = result . get ( 'reason' , None ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# error = None #NEWLINE# reason = '' #NEWLINE# #UNINDENT# if ( ( error == 'conflict' ) or ( error == 'file_exists' ) ) : #NEWLINE# #INDENT# raise exceptions . Conflict ( ( reason or 'Conflict' ) ) #NEWLINE# #UNINDENT# if ( response . status_code > 205 ) : #NEWLINE# #INDENT# if ( ( response . status_code == 404 ) or ( reason == 'not_found' ) ) : #NEWLINE# #INDENT# raise exceptions . NotFound ( ( reason or 'Not found' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( error == 'bad_request' ) : #NEWLINE# #INDENT# raise exceptions . BadRequest ( ( reason or 'Bad request' ) ) #NEWLINE# #UNINDENT# #UNINDENT# raise exceptions . GenericError ( result )