From d77b4f05c3e560905df781ce6e0d4644ebcdb00a Mon Sep 17 00:00:00 2001 From: Adrien Abraham Date: Tue, 5 Mar 2024 10:28:41 +0100 Subject: [PATCH] openobs: tiny script to open obs UUIDs --- openobs.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 openobs.py diff --git a/openobs.py b/openobs.py new file mode 100755 index 0000000..b4a19cf --- /dev/null +++ b/openobs.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +import argparse +import uuid +import webbrowser + +OBS_URL_F = "https://openobs.mnhn.fr/redirect/sinp/occurrences/{obs_uuid}" +TEST1 = "45A202E8-A4D0-41E9-AC27-041004CB8AD0" +TEST2 = "45A202E8A4D041E9AC27041004CB8AD0" + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("uuid") + args = parser.parse_args() + open_uuid(args.uuid) + + +def open_uuid(uuid_str: str): + obs_uuid = uuid.UUID(uuid_str) + webbrowser.open_new_tab(OBS_URL_F.format(obs_uuid=str(obs_uuid))) + + +if __name__ == "__main__": + main()