From 7b327fa9912e70841a5960fe40520c2eaa19d858 Mon Sep 17 00:00:00 2001 From: Eduard Friske <eduard.friske@ptb.de> Date: Mon, 6 May 2024 10:12:53 +0200 Subject: [PATCH] =?UTF-8?q?Konfigdatei=20f=C3=BCr=20Laborbuch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API-V2-elab.py | 24 ++++++++++++++++++++++-- attachment_cer.py | 4 ++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/API-V2-elab.py b/API-V2-elab.py index c27d12e..9671888 100644 --- a/API-V2-elab.py +++ b/API-V2-elab.py @@ -12,6 +12,7 @@ import datetime import elabapi_python from elabapi_python.rest import ApiException import requests +import argparse import json import couchdb import numpy as np @@ -22,6 +23,25 @@ from urllib3 import disable_warnings couch = couchdb.Server('http://a73434.berlin.ptb.de:5984') db = couch['vl_db'] # existing +config_file = "config.json" +with open(config_file) as fp: + config = json.load(fp) + +cmd_parser = argparse.ArgumentParser(description= "Schreibt erstellen kalibrierschein (TeX und PDF) in die CouchDB") +cmd_parser.add_argument("cal_no", type= int, metavar= "<Kalibrierschein-Nummer>", nargs= "*") +cmd_parser.add_argument("-e", "--elab", type= int, metavar= "<eLab ID>") +args = cmd_parser.parse_args() + +if args.elab is not None: + elab_id = str(args.elab) + +cers = [""] * len(args.cal_no) +#print(args.cal_no) + +for pos in range(len(args.cal_no)): + cers[pos] = str(args.cal_no[pos]) +print(cers) + ######################### # CONFIG # ######################### @@ -59,8 +79,8 @@ today = datetime.date.today() ######## -elab_id=647 -cers = ["75556_0001","75557_0001","75558_0001","75559_0001"] # Beispiel: cers = ["75511_0001","75512_0001"] +#elab_id=648 +#cers = ["75586_0001"] # Beispiel: cers = ["75511_0001","75512_0001"] TL1_2= "TLA" #### FM1 oder TLA year = str(config["KS-Daten"]["Jahr"]) diff --git a/attachment_cer.py b/attachment_cer.py index 794545f..457b742 100644 --- a/attachment_cer.py +++ b/attachment_cer.py @@ -39,7 +39,7 @@ print(cers) #cers = ["75559"] # Beispiel: cers = ["75511_0001","75512_0001"] #cers = ["75562","75563"] # Beispiel: cers = ["75511_0001","75512_0001"] -exit() +#exit() ################### die Kalibrierscheine werden an das cer-json-dokument angehangen ################## i = 0 while i < len(cers): @@ -61,7 +61,7 @@ while i < len(cers): ################### die Kalibrierscheine werden im Ordner Kalibrierscheine gelöscht ################## -exit() +#exit() i = 0 while i < len(cers): -- GitLab