from flask import render_template
from plaid.exceptions import ApiException
from werkzeug.wrappers import response
Simplified import and usage of datetime functions.
Fixed a bug in while num_retries_remaining > 0 code block, and the line just following it. In both the error_response = ... and if asset_report_json ... blocks, the variable e was unbound. This is resolved by declaring err as None before the block, then assigning to err on each retry. err is then used after the while block.
I also put an else: before the two lines starting with error_response = ... so they would actually run. My assumption is that these were meant to run if the error is anything aside from PRODUCT_NOT_READY, whereas currently the continue statement makes those lines unreachable.
Removed unused variable
asset_report_pdf
. Removed unused imports:Simplified import and usage of
datetime
functions.Fixed a bug in
while num_retries_remaining > 0
code block, and the line just following it. In both theerror_response = ...
andif asset_report_json ...
blocks, the variablee
was unbound. This is resolved by declaringerr
as None before the block, then assigning toerr
on each retry.err
is then used after thewhile
block.I also put an
else:
before the two lines starting witherror_response = ...
so they would actually run. My assumption is that these were meant to run if the error is anything aside fromPRODUCT_NOT_READY
, whereas currently thecontinue
statement makes those lines unreachable.