capiq-python icon indicating copy to clipboard operation
capiq-python copied to clipboard

how do I avoid a cache if there is an exception (so that I do not cache S&P Capital IQ issues)

Open euricocovas opened this issue 3 years ago • 0 comments

Sometimes S&P capital iq API has an issue. It happens daily, it timesout, maybe when their db is being changed. It's their bug. The response is 200, but I have a ""ErrMsg":"Username for destination system is not mapped."

Anyway, the request_caches caches into the SQLite the call and answer, even if we got a

raise CiqServiceException(response.json()['GDSSDKResponse'][0]["ErrMsg"])

So my question is, can we easily avoid/clear the SQLLite cache blob if we have an exception. it seems it always caches, at this point:

response = requests.post(self._endpoint, headers=self._headers, data=json.dumps(req),
                                 auth=HTTPBasicAuth(self._username, self._password), verify=self._verify)

which comes before the raise CiqServiceException(response.json()['GDSSDKResponse'][0]["ErrMsg"])

Thanks very much,

Eurico

euricocovas avatar Jan 24 '22 11:01 euricocovas