Exemple #1
0
def setup_api(dp_token: str,
              dp_host: str,
              debug: bool = False,
              logs: TextIO = None):
    """Init the Datapane API for automated use"""
    # login, ping, and create the default env file for CMD usage
    api.login(token=dp_token, server=dp_host, cli_login=False)
    # setup input and config, logging, login, etc.
    verbosity = 2 if debug else 0
    _setup_dp_logging(verbosity=verbosity, logs_stream=logs)
    log.debug("Running DP on DP")
Exemple #2
0
def setup_api(dp_host: str,
              dp_token: str,
              debug: bool = False,
              logs: TextIO = None):
    """Init the Datapane API for automated use"""
    # setup input and config, logging, login, etc.
    config = c.Config(server=dp_host, token=dp_token, analytics=False)
    verbosity = 2 if debug else 0
    _setup_dp_logging(verbosity=verbosity, logs_stream=logs)
    c.init(config=config)
    # check can login/ping
    api.ping(config=config)
    log.debug("Running DP on DP")
Exemple #3
0
def init(verbosity: int, config_env: str):
    """Init the cmd-line env"""
    c.init(config_env=config_env)
    _setup_dp_logging(verbosity=verbosity)
Exemple #4
0
from datapane.common import DPMode, _setup_dp_logging, set_dp_mode

# run this at global level as want debug logging for all tests
set_dp_mode(DPMode.APP)
_setup_dp_logging(verbosity=2)

# @pytest.fixture(scope="session")
# def dp_init():
#     from datapane.common.utils import setup_local_logging
#     # init API with full debug logging
#     print("dp_init")
#     setup_local_logging(verbosity=2)
#     yield
#     print("closing dp_init")