Beispiel #1
0
import argparse
import logging
import pandas
from lib import my_env
from lib import murcsrest

if __name__ == "__main__":
    # Configure command line arguments
    parser = argparse.ArgumentParser(
        description="Load a Site file into Murcs"
    )
    parser.add_argument('-f', '--filename', type=str, required=True,
                        help='Please provide the site file to load.')
    args = parser.parse_args()
    cfg = my_env.init_env("bellavista", __file__)
    r = murcsrest.MurcsRest(cfg)
    logging.info("Arguments: {a}".format(a=args))

    # Read the file
    df = pandas.read_excel(args.filename)
    my_loop = my_env.LoopInfo("Sites", 20)
    for row in df.iterrows():
        my_loop.info_loop()
        # Get excel row in dict format
        xl = row[1].to_dict()
        siteId = xl.pop("siteId")
        payload = dict(
            siteId=siteId
        )
        for k in xl:
            if pandas.notnull(xl[k]):
Beispiel #2
0
"""
This script will collect information from Murcs and store it in a local database.
"""
import logging
from lib import localstore
from lib import my_env
from lib.murcs import *
from lib import murcsrest

solToSol_done = []

cfg = my_env.init_env("bellavista", __file__)
r = murcsrest.MurcsRest()
lcl = localstore.sqliteUtils()

logging.info("Get Version Information")
res = r.get_version()
lcl.insert_row("version", res)

res = []
logging.info("Get Site information")
r.get_data("sites", reslist=res)
lcl.insert_rows("site", res)

logging.info("Handling Person information")
res = []
r.get_data("persons", reslist=res)
lcl.insert_rows("person", res)

logging.info("Handling Servers")
res = []