Revision 14578
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/lib/tnrs.py | ||
---|---|---|
132 | 132 |
+response) |
133 | 133 |
return match.groups() |
134 | 134 |
|
135 |
export_cols = None |
|
136 |
|
|
135 | 137 |
def single_tnrs_request(names, debug=False, cumulative_profiler=None, |
136 | 138 |
use_tnrs_export=True): |
137 | 139 |
''' |
... | ... | |
143 | 145 |
@param use_tnrs_export whether to use TNRS's TSV export feature, which |
144 | 146 |
currently returns incorrect selected matches (vegpath.org/issues/943) |
145 | 147 |
''' |
148 |
global export_cols |
|
149 |
|
|
146 | 150 |
name_ct = len(names) |
147 | 151 |
assert name_ct <= max_names |
148 | 152 |
assert name_ct >= 1 # with no names, TNRS hangs indefinitely |
... | ... | |
151 | 155 |
def debug_log(label, str_=''): |
152 | 156 |
if debug: sys.stderr.write('\n'+label+':\n'+str_+'\n') |
153 | 157 |
|
158 |
if not use_tnrs_export and export_cols == None: # need export_cols |
|
159 |
debug_log('fetching export columns') |
|
160 |
export_cols = csvs.header(single_tnrs_request([''], debug, |
|
161 |
use_tnrs_export=True)) # need at least 1 name |
|
162 |
debug_log('export columns', strings.urepr(export_cols)) |
|
163 |
|
|
154 | 164 |
## HTTP |
155 | 165 |
headers = initial_headers.copy() # don't modify global constant! |
156 | 166 |
|
Also available in: Unified diff
lib/tnrs.py: single_tnrs_request(): use_tnrs_export=False: need to obtain export columns