class_docstr: BaseInteractiveApp is a base class for creating/accessing apps hosted on SageMaker.
docstr: Get domain id and user profile from Studio environment.
  
  To verify Studio environment, we check if NOTEBOOK_METADATA_FILE exists
  and domain id and user profile name are present in the file.
docstr_tok: ["Get","domain","id","and","user","profile","from","Studio","environment",".","To","verify","Studio","environment",",","we","check","if","NOTEBOOK_METADATA_FILE","exists","and","domain","id","and","user","profile","name","are","present","in","the","file","."]
code: def _get_domain_and_user(self):
      """Get domain id and user profile from Studio environment.
  
      To verify Studio environment, we check if NOTEBOOK_METADATA_FILE exists
      and domain id and user profile name are present in the file.
      """
      if not os.path.isfile(NOTEBOOK_METADATA_FILE):
          return
  
      try:
          with open(NOTEBOOK_METADATA_FILE, "rb") as metadata_file:
              metadata = json.loads(metadata_file.read())
      except OSError as err:
          logger.warning(
              "Could not load metadata due to unexpected error. %s", err
          )
          return
  
      if "DomainId" in metadata and "UserProfileName" in metadata:
          self._in_studio_env = True
          self._domain_id = metadata.get("DomainId")
          self._user_profile_name = metadata.get("UserProfileName")
  
imports: from __future__ import absolute_import
  import abc
  import base64
  import json
  import logging
  import os
  import re
  import webbrowser
  from typing import Optional
  import boto3
  from sagemaker.session import Session, NOTEBOOK_METADATA_FILE
label_desc: Use image node_id 4 for calling the BaseInteractiveApp obj's underlying member method code with example usage: obj._get_domain_and_user() without return types