コード例 #1
0
ファイル: auth.py プロジェクト: srikanthreddybethi/Hub
def login_fn(username, password):
    """ Logs in to Snark AI"""
    token = ""
    if token:
        logger.info("Token login.")
        logger.degug("Getting the token...")
        token = click.prompt(
            "Please paste the authentication token from {}".format(
                config.GET_TOKEN_REST_SUFFIX, type=str, hide_input=True))
        token = token.strip()
        AuthClient.check_token(token)
    else:
        logger.info(
            "Please log in using Activeloop credentials. You can register at https://app.activeloop.ai "
        )
        if not username:
            logger.debug("Prompting for username.")
            username = click.prompt("Username", type=str)
        username = username.strip()
        if not password:
            logger.debug("Prompting for password.")
            password = click.prompt("Password", type=str, hide_input=True)
        password = password.strip()
        token = AuthClient().get_access_token(username, password)
    TokenManager.set_token(token)
    HubControlClient().get_credentials()
    logger.info("Login Successful.")
コード例 #2
0
ファイル: auth.py プロジェクト: vaughn-mcgill-adami/Hub
def register(username, email, password):
    """ Register at Activeloop AI"""
    if not username:
        logger.debug("Prompting for username.")
        username = click.prompt("Username", type=str)
    username = username.strip()
    if not email:
        logger.debug("Prompting for email.")
        email = click.prompt("Email", type=str)
    email = email.strip()
    if not password:
        logger.debug("Prompting for password.")
        password = click.prompt("Password", type=str, hide_input=True)
    password = password.strip()
    AuthClient().register(username, email, password)
    token = AuthClient().get_access_token(username, password)
    TokenManager.set_token(token)
    consent_message = textwrap.dedent("""
        Privacy policy:
        We collect basic system information and crash reports so that we can keep
        improving your experience using Hub to work with your data.

        You can find out more by reading our privacy policy:
            https://www.activeloop.ai/privacy/

        If you would like to opt out of reporting crashes and system information,
        run the following command:
            $ hub reporting --off
        """)
    logger.info(consent_message)
    configure_reporting(True, username=username)
コード例 #3
0
ファイル: auth.py プロジェクト: srikanthreddybethi/Hub
def register(username, email, password):
    """ Register at Activeloop AI"""
    if not username:
        logger.debug("Prompting for username.")
        username = click.prompt("Username", type=str)
    username = username.strip()
    if not email:
        logger.debug("Prompting for email.")
        email = click.prompt("Email", type=str)
    email = email.strip()
    if not password:
        logger.debug("Prompting for password.")
        password = click.prompt("Password", type=str, hide_input=True)
    password = password.strip()
    AuthClient().register(username, email, password)
    token = AuthClient().get_access_token(username, password)
    TokenManager.set_token(token)
コード例 #4
0
ファイル: base.py プロジェクト: zgsxwsdxg/Hub
 def __init__(self):
     self.auth_header = TokenManager.get_auth_header()
コード例 #5
0
ファイル: auth.py プロジェクト: srikanthreddybethi/Hub
def logout():
    """ Logs out of Activeloop AI"""
    TokenManager.purge_token()