-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadd_tree.py
More file actions
28 lines (24 loc) · 843 Bytes
/
add_tree.py
File metadata and controls
28 lines (24 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import argparse
from pathlib import Path
import common
from functions import add_tree_fn
parser = argparse.ArgumentParser()
parser.add_argument("project_id", help="The unique ID that defines the Microreact project")
parser.add_argument("newick_file", help="Path to a Newick file containing the tree to add")
parser.add_argument(
"--noverify",
help="Do not verify SSL certificate of Microreact host ",
action="store_true"
)
args = parser.parse_args()
with open(Path(args.newick_file), 'r') as newick_file:
newick = newick_file.read()
rest_response = add_tree_fn(
project_id=args.project_id,
newick=newick,
mr_access_token=common.MICROREACT_ACCESS_TOKEN,
mr_base_url=common.MICROREACT_BASE_URL,
verify = not args.noverify
)
print(f"REST response: {str(rest_response)}")
print(rest_response.json())