1
|
#!/usr/bin/env python
|
2
|
# A TNRS client
|
3
|
# When using xargs to pass many names, note that xargs will by default split its
|
4
|
# arguments into chunks of 5000. You can change this using the -n option.
|
5
|
# Note that obtaining an actual CSV requires four (!) steps: submit, retrieve,
|
6
|
# prepare download, and download.
|
7
|
|
8
|
import os.path
|
9
|
import sys
|
10
|
|
11
|
sys.path.append(os.path.dirname(__file__)+"/../lib")
|
12
|
|
13
|
import opts
|
14
|
import streams
|
15
|
import tnrs
|
16
|
|
17
|
def main():
|
18
|
# Input
|
19
|
env_names = []
|
20
|
debug = opts.env_flag('debug', False, env_names)
|
21
|
use_tnrs_export = opts.env_flag('use_tnrs_export', False, env_names)
|
22
|
names = sys.argv[1:]
|
23
|
if not names: raise SystemExit('Usage: '+opts.env_usage(env_names, True)
|
24
|
+' '+sys.argv[0]+' name... >out 2>>log')
|
25
|
|
26
|
streams.copy(tnrs.tnrs_request(names, debug,
|
27
|
use_tnrs_export=use_tnrs_export), sys.stdout)
|
28
|
|
29
|
main()
|