#NEWLINE# def _check_api_info( self ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if ( not self . API_URL ) : #NEWLINE# #INDENT# for url in self . API_URLS : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# response = self . _handle_api_error ( requests . get ( '{}/info' . format ( url ) ) ) . json ( ) #NEWLINE# self . API_URL = url #NEWLINE# break #NEWLINE# #UNINDENT# except requests . ConnectionError : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# response = self . _handle_api_error ( requests . get ( '{}/info' . format ( self . API_URL ) ) ) . json ( ) #NEWLINE# #UNINDENT# except requests . ConnectionError : #NEWLINE# #INDENT# self . _die_on_error ( '[ERROR] Provided API URL is unavailable.' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not self . API_URL ) : #NEWLINE# #INDENT# self . _die_on_error ( '[ERROR] SSL Labs APIs are down. Please try again later.' ) #NEWLINE# #UNINDENT# self . MAX_ASSESSMENTS = response . get ( 'maxAssessments' ) #NEWLINE# self . CLIENT_MAX_ASSESSMENTS = response . get ( 'clientMaxAssessments' ) #NEWLINE# self . CURRENT_ASSESSMENTS = response . get ( 'currentAssessments' ) #NEWLINE# if ( self . MAX_ASSESSMENTS <= 0 ) : #NEWLINE# #INDENT# if self . DEBUG : #NEWLINE# #INDENT# print ( 'Rate limit reached' ) #NEWLINE# #UNINDENT# return False #NEWLINE# #UNINDENT# if ( not self . QUIET ) : #NEWLINE# #INDENT# print ( '[NOTICE] SSL Labs v{engine_version} (criteria version {criteria_version})' . format ( engine_version = response . get ( 'engineVersion' ) , criteria_version = response . get ( 'criteriaVersion' ) ) ) #NEWLINE# print ( '[NOTICE] {server_message}' . format ( server_message = response . get ( 'messages' ) [ 0 ] ) ) #NEWLINE# #UNINDENT# return True #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# if url . DEBUG : #NEWLINE# #INDENT# print ( e ) #NEWLINE# #UNINDENT# return False