fluvio.cloud

 1from ._fluvio_python import Cloud
 2import logging
 3
 4DEFAULT_REMOTE = "https://infinyon.cloud"
 5logger = logging.getLogger(__name__)
 6logger.setLevel(logging.INFO)
 7consoleHandler = logging.StreamHandler()
 8consoleHandler.setLevel(logging.CRITICAL)
 9logger.addHandler(consoleHandler)
10
11
12def login(
13    useOauth2=True,
14    remote=DEFAULT_REMOTE,
15    profile=None,
16    email=None,
17    password=None,
18):
19    if email is not None and password is not None:
20        Cloud.login_with_username(remote, profile, email, password)
21    else:
22        cloudClient = Cloud.new(remote)
23        auth0_url, user_code = cloudClient.get_auth0_url()
24        logger.critical(
25            f"Please visit the following URL: {auth0_url} and verify the following code: {user_code} matches.\n Then, proceed with authentication."  # noqa: E501
26        )
27        consoleHandler.flush()
28        cloudClient.authenticate_with_auth0()
def login( useOauth2=True, remote='https://infinyon.cloud', profile=None, email=None, password=None):
13def login(
14    useOauth2=True,
15    remote=DEFAULT_REMOTE,
16    profile=None,
17    email=None,
18    password=None,
19):
20    if email is not None and password is not None:
21        Cloud.login_with_username(remote, profile, email, password)
22    else:
23        cloudClient = Cloud.new(remote)
24        auth0_url, user_code = cloudClient.get_auth0_url()
25        logger.critical(
26            f"Please visit the following URL: {auth0_url} and verify the following code: {user_code} matches.\n Then, proceed with authentication."  # noqa: E501
27        )
28        consoleHandler.flush()
29        cloudClient.authenticate_with_auth0()