@@ -191,9 +191,9 @@ def __ship(retry_attempts, wait=0):
191191 self .console_message ("ship: beginning message ship!" , level = 2 )
192192 if (retry_attempts <= 0 ):
193193 if (self .DebugLevel >= 2 ):
194- raise Exception ("shipping logs failed.. network issue?" )
194+ raise Exception ("shipping failed.. network issue?" )
195195 else :
196- self .console_message ("ship: ISStreamer failed to ship the logs after a number of attempts." , level = 0 )
196+ self .console_message ("ship: ISStreamer failed to ship after a number of attempts." , level = 0 )
197197 if (self .MissedEvents == None ):
198198 self .MissedEvents = open ("err_missed_events.txt" , 'w+' )
199199 if (self .MissedEvents != None ):
@@ -213,14 +213,19 @@ def __ship(retry_attempts, wait=0):
213213 elif (response .status == 402 ):
214214 self .console_message ("AccessKey exceeded limit for month, check account at www.initialstate.com/app" )
215215 raise Exception ("PAYMENT_REQUIRED" )
216+ elif (response .status == 429 ):
217+ self .console_message ("Request limit exceeded" )
218+ raise Exception ("REQUEST_LIMIT_EXCEEDED" )
216219 else :
217220 self .console_message ("ship: failed on attempt {atmpt} (StatusCode: {sc}; Reason: {r})" .format (sc = response .status , r = response .reason , atmpt = retry_attempts ))
218221 raise Exception ("ship exception" )
219222 except Exception as ex :
220223 if (len (ex .args ) > 0 and ex .args [0 ] == "PAYMENT_REQUIRED" ):
221224 raise Exception ("Either account is capped or an upgrade is required." )
225+ if (len (ex .args ) > 0 and ex .args [0 ] == "REQUEST_LIMIT_EXCEEDED" ):
226+ raise Exception ("Request limit has been exceeded, please limit request rate." )
222227
223- self .console_message ("ship: exception shipping logs on attempt {atmpt}." .format (atmpt = retry_attempts ))
228+ self .console_message ("ship: exception shipping on attempt {atmpt}." .format (atmpt = retry_attempts ))
224229 retry_attempts = retry_attempts - 1
225230 __ship (retry_attempts , 1 )
226231
0 commit comments