from flask_restful import Resource import time import datetime from models.slr import slr from models.tokens import TokensModel from flask_jwt import jwt_required from models.sl_logger import SlLogger from resources.slrrequestcode import SlrRequestCode logger = SlLogger.get_logger(__name__) class Exportreqcodes(Resource): def __init__(self): self.slr = slr("", "", "") pass def __del__(self): del (self.slr) pass @jwt_required() def get(self, uuid): try: rows = TokensModel.join_by_uuid(uuid, "slr_request_code_tbl", "device_store") logger.info( "Printing rows of devices. This should be one per device...") logger.info(rows) except Exception as e: print(e)
from resources.forgotPassword import ForgotPassword from security import authenticate, identity import platform import config from pathlib import Path import yaml from models.sl_logger import SlLogger # Fetch App secret key from config.yaml home = str(Path.home()) app = Flask(__name__, static_folder='frontend/build/static') CORS(app) app.config['JWT_EXPIRATION_DELTA'] = timedelta(minutes=30) logger = SlLogger.get_logger("netmiko") logger = SlLogger.get_logger("paramiko.transport") try: with open(home + "/config.yaml", 'r') as yamlfile: cfg = yaml.load(yamlfile) sec_key = cfg['secret_key'] except Exception: raise ("Secret Key not found!") app.secret_key = sec_key api = Api(app) jwt = JWT(app, authenticate, identity)