@_assure_identity
def set_credentials(username, api_key=None, password=None, region=None, tenant_id=None, authenticate=True):
 global regions, services
 pw_key = (password or api_key)
 region = _safe_region(region)
 tenant_id = (tenant_id or settings.get('tenant_id'))
 identity.set_credentials(username=username, password=pw_key, tenant_id=tenant_id, region=region, authenticate=authenticate)
 regions = tuple(identity.regions)
 services = tuple(identity.services.keys())
 connect_to_services(region=region)

@ _assure_identity def set_credentials ( username , api_key = None , password = None , region = None , tenant_id = None , authenticate = True ) : global regions , services pw_key = ( password or api_key ) region = _safe_region ( region ) tenant_id = ( tenant_id or settings . get ( 'tenant_id' ) ) identity . set_credentials ( username = username , password = pw_key , tenant_id = tenant_id , region = region , authenticate = authenticate ) regions = tuple ( identity . regions ) services = tuple ( identity . services . keys ( ) ) connect_to_services ( region = region )
set the credentials directly .