Project

General

Profile

« Previous | Next » 

Revision 5091

repeated_tnrs_request(): When retrying after an invalid response, output protocol info for debugging

View differences:

lib/tnrs.py
125 125
    debug_log('response info', str(response.info()))
126 126
    return response
127 127

  
128
def repeated_tnrs_request(taxons, *args, **kw_args):
128
def repeated_tnrs_request(taxons, debug=False, **kw_args):
129 129
    for try_num in xrange(max_tries):
130
        try: return tnrs_request(taxons, *args, **kw_args)
131
        except InvalidResponse: pass # try again
130
        try: return tnrs_request(taxons, debug, **kw_args)
131
        except InvalidResponse:
132
            debug = True # next time, output protocol info for debugging
133
            # try again
132 134
    raise # error is not temporary

Also available in: Unified diff