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_auth_token_requester(token=None, service_account_key=None, metadata_addr=_MDS_ADDR):
if token is not None and service_account_key is not None:
raise RuntimeError("Conflicting API credentials properties 'token' and 'service_account_key' are set.")
if token is not None:
return TokenAuth(token=token)
if service_account_key is not None:
__validate_service_account_key(service_account_key)
return ServiceAccountAuth(service_account_key)
return MetadataAuth(metadata_addr=metadata_addr)