Revision 5006
Added by Aaron Marcuse-Kubitza about 12 years ago
lib/tnrs.py | ||
---|---|---|
119 | 119 |
|
120 | 120 |
debug_log('Download') |
121 | 121 |
response = urllib2.urlopen(urllib2.Request(csv_url)) |
122 |
response_str = streams.read_all(response) |
|
123 | 122 |
debug_log('response info', str(response.info())) |
124 |
return response_str |
|
123 |
return response |
bin/tnrs_client | ||
---|---|---|
11 | 11 |
sys.path.append(os.path.dirname(__file__)+"/../lib") |
12 | 12 |
|
13 | 13 |
import opts |
14 |
import streams |
|
14 | 15 |
import tnrs |
15 | 16 |
|
16 | 17 |
def main(): |
... | ... | |
21 | 22 |
if not taxons: raise SystemExit('Usage: '+opts.env_usage(env_names, True) |
22 | 23 |
+' '+sys.argv[0]+' taxon... >out 2>>log') |
23 | 24 |
|
24 |
sys.stdout.write(tnrs.tnrs_request(taxons, debug))
|
|
25 |
streams.copy(tnrs.tnrs_request(taxons, debug), sys.stdout)
|
|
25 | 26 |
|
26 | 27 |
main() |
Also available in: Unified diff
tnrs.py: tnrs_request(): Return the CSV stream directly instead of reading it into a string