Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_authentication():
""" Gets the authentication for connecting to the Quantum Inspire API."""
token = load_account()
if token is not None:
return get_token_authentication(token)
else:
if QI_EMAIL is None or QI_PASSWORD is None:
print('Enter email:')
email = input()
print('Enter password')
password = getpass()
else:
email, password = QI_EMAIL, QI_PASSWORD
return get_basic_authentication(email, password)
def get_authentication():
""" Gets the authentication for connecting to the Quantum Inspire API."""
token = load_account()
if token is not None:
return get_token_authentication(token)
else:
if QI_EMAIL is None or QI_PASSWORD is None:
print('Enter email:')
email = input()
print('Enter password')
password = getpass()
else:
email, password = QI_EMAIL, QI_PASSWORD
return get_basic_authentication(email, password)
def set_basic_authentication(self, email: str, password: str, qi_url: str = QI_URL) -> None:
"""
Set up basic authentication for Quantum Inspire.
Args:
email: A valid email address.
password: Password for the account.
qi_url: URL that points to quantum-inspire api. Default value: 'https://api.quantum-inspire.com'.
"""
authentication = get_basic_authentication(email, password)
self.set_authentication(authentication, qi_url)
def get_authentication():
""" Gets the authentication for connecting to the Quantum Inspire API."""
token = load_account()
if token is not None:
return get_token_authentication(token)
else:
if QI_EMAIL is None or QI_PASSWORD is None:
print('Enter email:')
email = input()
print('Enter password')
password = getpass()
else:
email, password = QI_EMAIL, QI_PASSWORD
return get_basic_authentication(email, password)
def get_authentication():
""" Gets the authentication for connecting to the Quantum Inspire API."""
token = load_account()
if token is not None:
return get_token_authentication(token)
else:
if QI_EMAIL is None or QI_PASSWORD is None:
print('Enter email:')
email = input()
print('Enter password')
password = getpass()
else:
email, password = QI_EMAIL, QI_PASSWORD
return get_basic_authentication(email, password)