<s> """<STR_LIT>""" <EOL> import time <EOL> from cloudcafe . networking . networks . common . behaviors import NetworkingBaseBehaviors , NetworkingResponse <EOL> from cloudcafe . networking . networks . common . exceptions import ResourceGetException <EOL> from cloudcafe . networking . networks . extensions . limits_api . constants import LimitsResponseCodes <EOL> class LimitsBehaviors ( NetworkingBaseBehaviors ) : <EOL> def __init__ ( self , limits_client , limits_config ) : <EOL> super ( LimitsBehaviors , self ) . __init__ ( ) <EOL> self . config = limits_config <EOL> self . client = limits_client <EOL> def get_limits ( self , page_reverse = None , <EOL> resource_get_attempts = None , <EOL> raise_exception = False , poll_interval = None ) : <EOL> """<STR_LIT>""" <EOL> poll_interval = poll_interval or self . config . api_poll_interval <EOL> resource_get_attempts = ( resource_get_attempts or <EOL> self . config . api_retries ) <EOL> result = NetworkingResponse ( ) <EOL> err_msg = '<STR_LIT>' <EOL> for attempt in range ( resource_get_attempts ) : <EOL> self . _log . debug ( <EOL> '<STR_LIT>' . format ( <EOL> attempt + <NUM_LIT:1> , <EOL> resource_get_attempts ) ) <EOL> resp = self . client . get_limits ( page_reverse = page_reverse ) <EOL> resp_check = self . check_response ( <EOL> resp = resp , <EOL> status_code = LimitsResponseCodes . GET_LIMITS , <EOL> label = '<STR_LIT>' , <EOL> message = err_msg ) <EOL> result . response = resp <EOL> if resp_check is None : <EOL> return result <EOL> result . failures . append ( resp_check ) <EOL> time . sleep ( poll_interval ) <EOL> else : <EOL> err_msg = ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) . format ( resource_get_attempts , result . failures ) <EOL> self . _log . error ( err_msg ) <EOL> if raise_exception : <EOL> raise ResourceGetException ( err_msg ) <EOL> return result </s>
