AlienVault-OTX / OTX-Python-SDK

The Python SDK for AlienVault OTX
Other
358 stars 162 forks source link

Questionable 429 in status_forcelist #34

Open bieron opened 7 years ago

bieron commented 7 years ago

A question regarding OTXv2.session(). Please correct me if I'm wrong, but should 429 be included in status_forcelist? If the server says "too many requests", asking again in a second or half probably won't help.

self.request_session.mount('https://', HTTPAdapter(                                                                    
    max_retries=Retry(                                                                                                 
        total=5,                                                                                                       
        status_forcelist=[429, 500, 502, 503],                                                                         
        backoff_factor=1,                                                                                              
    )                                                                                                                  
))
chrisdoman commented 7 years ago

Hi,

I didn't write that bit of the code, at a guess I'd assume the backoff factor could be increased.

Are you seeing many 429 status codes yourself? If so I can take a look

Thanks,

bieron commented 7 years ago

yeah, increasing backoff seems sound as well, but still mostly for 5xx

Are you seeing many 429 status codes yourself?

haven't been testing long, so just once for now. Will let you know if it becomes an impediment. For the record I don't actually see the 429 itself - the OTXv2 pip lib tries to decode the response, but there is None, so it fails - had to debug the lib to see that the response code is in fact 429 - but that is not an issue of this repo.

Neat tool by the way

chrisdoman commented 7 years ago

Thanks!

I've increased the backoff for now, we do have stability issues sometimes so I'll see what this does