def prepare_credentials(auth): if not all([auth.get('username'), auth.get('password')]): raise ImproperlyConfigured( 'Username or password missing from auth configuration ' 'for heartbeat')