Source code for cwbrowser.utils

##########################################################################
# NSAp - Copyright (C) CEA, 2013 - 2018
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
# for details.
##########################################################################

"""
A module with common functions.
"""

# System import
import getpass





[docs]def ask_credential(login=None, password=None): """ Ask for a login and a password when not specified. Parameters ---------- login: str, default None a login. password: str, defualt None a password. Returns ------- login: str, default None a login. password: str, defualt None a password. """ if login is None: login = raw_input("Login:") if password is None: password = getpass.getpass("Password for " + login + ":") return login, password