-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcb_spider.py
More file actions
36 lines (30 loc) · 1.04 KB
/
Copy pathcb_spider.py
File metadata and controls
36 lines (30 loc) · 1.04 KB
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
29
30
31
32
33
34
35
36
"""Permission-gated legacy launcher for the original ChemicalBook workflow."""
from aromanexus.sources.chemicalbook import (
PERMISSION_PHRASE,
ChemicalBookLegacyClient,
)
from aromanexus.workflows import run_chemicalbook_legacy
INPUT_FILE = "Odor.xlsx"
COL_CAS = "CAS Number"
def main() -> None:
print(
"ChemicalBook currently disallows these automated routes in robots.txt. "
"Continue only if you have documented permission."
)
if input(f"Type {PERMISSION_PHRASE!r} to continue: ").strip() != PERMISSION_PHRASE:
print("Cancelled.")
return
output = INPUT_FILE.replace(".xlsx", "_cb_result.xlsx")
with ChemicalBookLegacyClient(permission_confirmed=True) as client:
summary = run_chemicalbook_legacy(
INPUT_FILE,
client,
output_path=output,
cas_column=COL_CAS,
include_provenance=False,
checkpoint_every=5,
force=True,
)
print(f"Done: {summary.output_path}")
if __name__ == "__main__":
main()