diff --git a/API-V2-elab.py b/API-V2-elab.py index c27d12edd924cdd7b1714870a6f0123c83d33d01..96718884a7ab5cde2b3501bd9e15d5dc34eb8fa6 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 794545fde7578fc36c1c6b5f1dbdf6b579f7c4ea..457b742ab9329e6f4173f8e48f96cabc08bd4b3b 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):