diff omero_metadata_upload.py @ 3:83ccd2b525e5 draft

planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 266752b0162fbdb32f132a6702cb661ae36f48f0
author ufz
date Thu, 12 Sep 2024 16:30:43 +0000
parents f762de618b1f
children 42a454d4b482
line wrap: on
line diff
--- a/omero_metadata_upload.py	Thu Sep 05 11:55:50 2024 +0000
+++ b/omero_metadata_upload.py	Thu Sep 12 16:30:43 2024 +0000
@@ -1,4 +1,5 @@
 import argparse
+import json
 from datetime import datetime
 
 import ezomero as ez
@@ -73,8 +74,7 @@
 
 if __name__ == "__main__":
     parser = argparse.ArgumentParser(description='Import metadata into OMERO.')
-    parser.add_argument('--user', required=True, help='OMERO username')
-    parser.add_argument('--pws', required=True, help='OMERO password')
+    parser.add_argument("--credential-file", dest="credential_file", type=str, required=True, help="Credential file (JSON file with username and password for OMERO)")
     parser.add_argument('--host', required=True, help='OMERO host')
     parser.add_argument('--port', required=True, type=int, help='OMERO port')
     parser.add_argument('--obj_type', required=True, choices=['project', 'screen', 'dataset', 'image'],
@@ -87,6 +87,9 @@
 
     args = parser.parse_args()
 
-    metadata_import_ezo(user=args.user, pws=args.pws, host=args.host, port=args.port,
+    with open(args.credential_file, 'r') as f:
+        crds = json.load(f)
+
+    metadata_import_ezo(user=crds['username'], pws=crds['password'], host=args.host, port=args.port,
                         obj_type=args.obj_type, did=args.did, ann_type=args.ann_type,
                         ann_file=args.ann_file, an_name=args.an_name, log_file=args.log_file)