tenable / pyTenable

Python Library for interfacing into Tenable's platform APIs
https://pytenable.readthedocs.io
MIT License
343 stars 172 forks source link

Accept and pass kwargs to _api.get() #665

Closed efojs closed 2 months ago

efojs commented 1 year ago

I get 500 sometimes when requesting /assets/<uuid>.

Error message recommends to retry: "Please wait a moment and try your request again" I want to retry by passing retry_on to RESTfly's APISession._req:

retry_codes = kwargs.pop('retry_on', []).

via

tenableio.assets.details(uuid, retry_on=[500])

But AssetsAPI.details() accepts only uuid: https://github.com/tenable/pyTenable/blob/414cd4a698f208ce0aae7bd4f24ee2d3404a4360/tenable/io/assets.py#L55

Would be great to accept and pass kwargs in all methods with return self._api.get()

Or is there a reason that I don't see why kwargs are not passed?

SteveMcGrath commented 2 months ago

Note, that if you want to have a specific exception type retried, then you can always modify the class retry like so:

from restfly.errors import NotFoundError

NotFoundError.retryable = True