Example #1
0
 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))
Example #2
0
    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)
Example #3
0
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)
Example #4
0
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)
Example #5
0
 def init_connection(self):
     os.environ["system_file"] = "./tests/testing_data/system.yaml"
     Utility.load_evironment()
     connect(host=Utility.environment['database']["url"])
Example #6
0
 def init_connection(self):
     Utility.load_evironment()
     connect(host=Utility.environment['database']["url"])
Example #7
0
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
Example #8
0
def cli():
    parser = create_argument_parser()
    arguments = parser.parse_args()
    Utility.load_evironment()
    connect(host=Utility.environment["database"]['url'])
    arguments.func(arguments)
Example #9
0
 def init_connection(self):
     os.environ["system_file"] = "./tests/testing_data/system.yaml"
     Utility.load_evironment()