def init_connection(self): os.environ["system_file"] = "./tests/testing_data/system.yaml" Utility.load_evironment() connect(host=Utility.environment["database"]['url']) pytest.bot = 'test' yield None shutil.rmtree(os.path.join('training_data', pytest.bot))
def setup(self): os.environ["system_file"] = "./tests/testing_data/system.yaml" Utility.load_evironment() db_url = Utility.environment['database']["url"] pytest.db_url = db_url connect(host=db_url)
def main(): parser = create_arg_parser() arguments = parser.parse_args() Utility.load_evironment() connect(host=Utility.environment['database']['url']) logger.info(arguments.bot) logger.info(arguments.user) start_training(arguments.bot, arguments.user, arguments.token)
def main(): parser = create_arg_parser() arguments = parser.parse_args() Utility.load_evironment() connect(host=Utility.environment['database']['url']) logger.info(arguments.bot) logger.info(arguments.user) logger.info(arguments.token) logger.debug("-t: " + arguments.train) if arguments.train.lower() == '--train' or arguments.train.lower() == '-t': start_training(arguments.bot, arguments.user, arguments.token)
def init_connection(self): os.environ["system_file"] = "./tests/testing_data/system.yaml" Utility.load_evironment() connect(host=Utility.environment['database']["url"])
def init_connection(self): Utility.load_evironment() connect(host=Utility.environment['database']["url"])
from datetime import datetime, timedelta from typing import Text from fastapi import Depends, HTTPException, status, Request from jwt import PyJWTError, decode, encode from kairon.utils import Utility from .models import User, TokenData from .processor import AccountProcessor Utility.load_evironment() class Authentication: """ Class contains logic for api Authentication """ SECRET_KEY = Utility.environment['security']["secret_key"] ALGORITHM = Utility.environment['security']["algorithm"] ACCESS_TOKEN_EXPIRE_MINUTES = Utility.environment['security'][ "token_expire"] async def get_current_user(self, request: Request, token: str = Depends(Utility.oauth2_scheme)): """ validates jwt token :param token: jwt token, default extracted by fastapi :param request: http request object
def cli(): parser = create_argument_parser() arguments = parser.parse_args() Utility.load_evironment() connect(host=Utility.environment["database"]['url']) arguments.func(arguments)
def init_connection(self): os.environ["system_file"] = "./tests/testing_data/system.yaml" Utility.load_evironment()