1 |
4918
|
aaronmk
|
#!/usr/bin/env python
|
2 |
|
|
# A TNRS client
|
3 |
4920
|
aaronmk
|
# 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 |
4918
|
aaronmk
|
# Note that obtaining an actual CSV requires four (!) steps: submit, retrieve,
|
6 |
4991
|
aaronmk
|
# prepare download, and download.
|
7 |
4918
|
aaronmk
|
|
8 |
|
|
import os.path
|
9 |
|
|
import sys
|
10 |
|
|
|
11 |
|
|
sys.path.append(os.path.dirname(__file__)+"/../lib")
|
12 |
|
|
|
13 |
|
|
import opts
|
14 |
4991
|
aaronmk
|
import tnrs
|
15 |
4918
|
aaronmk
|
|
16 |
4989
|
aaronmk
|
def main():
|
17 |
|
|
# Input
|
18 |
|
|
env_names = []
|
19 |
|
|
debug = opts.env_flag('debug', False, env_names)
|
20 |
|
|
taxons = sys.argv[1:]
|
21 |
|
|
if not taxons: raise SystemExit('Usage: '+opts.env_usage(env_names, True)
|
22 |
|
|
+' '+sys.argv[0]+' taxon... >out 2>>log')
|
23 |
|
|
|
24 |
4991
|
aaronmk
|
tnrs.tnrs_request(taxons, debug)
|
25 |
4989
|
aaronmk
|
|
26 |
4918
|
aaronmk
|
main()
|