#NEWLINE# def _handle_api_error( self , response ) : #NEWLINE# #INDENT# _status = response . status_code #NEWLINE# if ( _status == 200 ) : #NEWLINE# #INDENT# return response #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( _status == 400 ) : #NEWLINE# #INDENT# self . _die_on_error ( '[API] invocation error: {}' . format ( response . text ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( _status == 429 ) : #NEWLINE# #INDENT# self . _die_on_error ( '[API] client request rate too high or too many new assessments too fast: {}' . format ( response . text ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( _status == 500 ) : #NEWLINE# #INDENT# self . _die_on_error ( '[API] internal error: {}' . format ( response . text ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( _status == 503 ) : #NEWLINE# #INDENT# self . _die_on_error ( '[API] the service is not available: {}' . format ( response . text ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( _status == 529 ) : #NEWLINE# #INDENT# self . _die_on_error ( '[API] the service is overloaded: {}' . format ( response . text ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _die_on_error ( '[API] unknown status code: {}, {}' . format ( _status , response . text ) )