Revision 5108
Added by Aaron Marcuse-Kubitza about 12 years ago
lib/tnrs.py | ||
---|---|---|
15 | 15 |
assert initial_pause <= max_pause |
16 | 16 |
max_taxons = 5000# according to http://tnrs.iplantcollaborative.org/TNRSapp.html |
17 | 17 |
max_taxons = 500 # the maximum above crashes the TNRS server |
18 |
max_tries = 5 |
|
19 | 18 |
|
20 | 19 |
# Protocol params |
21 | 20 |
url_base = 'http://tnrs.iplantcollaborative.org/tnrsdemo/' |
... | ... | |
133 | 132 |
return response |
134 | 133 |
|
135 | 134 |
def repeated_tnrs_request(taxons, debug=False, **kw_args): |
136 |
for try_num in xrange(max_tries):
|
|
135 |
for try_num in xrange(2):
|
|
137 | 136 |
try: return tnrs_request(taxons, debug, **kw_args) |
138 | 137 |
except InvalidResponse, e: |
139 | 138 |
exc.print_ex(e, detail=False) |
140 |
debug = True # next time, output protocol info for debugging
|
|
141 |
# try again |
|
139 |
debug = True |
|
140 |
# try again with debug turned on
|
|
142 | 141 |
raise # error is not temporary |
Also available in: Unified diff
tnrs.py: repeated_tnrs_request(): Just retry the request once with with debug turned on, to avoid cluttering the log output with the verbose debug info of multiple failed requests if the error is not resolved on retry