Skip to content
Snippets Groups Projects
Commit 7b327fa9 authored by Eduard Friske's avatar Eduard Friske
Browse files

Konfigdatei für Laborbuch

parent 697f65e9
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,7 @@ import datetime ...@@ -12,6 +12,7 @@ import datetime
import elabapi_python import elabapi_python
from elabapi_python.rest import ApiException from elabapi_python.rest import ApiException
import requests import requests
import argparse
import json import json
import couchdb import couchdb
import numpy as np import numpy as np
...@@ -22,6 +23,25 @@ from urllib3 import disable_warnings ...@@ -22,6 +23,25 @@ from urllib3 import disable_warnings
couch = couchdb.Server('http://a73434.berlin.ptb.de:5984') couch = couchdb.Server('http://a73434.berlin.ptb.de:5984')
db = couch['vl_db'] # existing 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 # # CONFIG #
######################### #########################
...@@ -59,8 +79,8 @@ today = datetime.date.today() ...@@ -59,8 +79,8 @@ today = datetime.date.today()
######## ########
elab_id=647 #elab_id=648
cers = ["75556_0001","75557_0001","75558_0001","75559_0001"] # Beispiel: cers = ["75511_0001","75512_0001"] #cers = ["75586_0001"] # Beispiel: cers = ["75511_0001","75512_0001"]
TL1_2= "TLA" #### FM1 oder TLA TL1_2= "TLA" #### FM1 oder TLA
year = str(config["KS-Daten"]["Jahr"]) year = str(config["KS-Daten"]["Jahr"])
......
...@@ -39,7 +39,7 @@ print(cers) ...@@ -39,7 +39,7 @@ print(cers)
#cers = ["75559"] # Beispiel: cers = ["75511_0001","75512_0001"] #cers = ["75559"] # Beispiel: cers = ["75511_0001","75512_0001"]
#cers = ["75562","75563"] # 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 ################## ################### die Kalibrierscheine werden an das cer-json-dokument angehangen ##################
i = 0 i = 0
while i < len(cers): while i < len(cers):
...@@ -61,7 +61,7 @@ while i < len(cers): ...@@ -61,7 +61,7 @@ while i < len(cers):
################### die Kalibrierscheine werden im Ordner Kalibrierscheine gelöscht ################## ################### die Kalibrierscheine werden im Ordner Kalibrierscheine gelöscht ##################
exit() #exit()
i = 0 i = 0
while i < len(cers): while i < len(cers):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment