text: """
  ml/api/v1/info.py
  """
  import flask
  import json
  import jsonpickle
  import os
  
  from ml.app_connexion import application
  from ml.app_config import \
      api_name, api_desc, api_version, \
      api_path, \
      api_docs_url, \
      api_spec, api_spec_file, api_spec_path, \
      app_env
  
  LOGGER = application.logger
  
  
  def get_api_doc():
      """
      Get API spec file, e.g. swagger.yaml.
      """
      curr_path = os.path.dirname(os.path.realpath(__file__))
      root_path = os.path.dirname(os.path.dirname(curr_path))
      spec_path = os.path.join(root_path, api_spec_path)
  
      LOGGER.debug('downloading %s/%s', spec_path, api_spec_file)
      res = flask.send_from_directory(
          spec_path, api_spec_file,
          as_attachment=True,
          attachment_filename='swagger-pyml.yaml',
          mimetype='application/octet-stream'
      )
      return res
  
  
  def get_info():
      """
      Get API information.
      """
      base_url = flask.request.host_url.strip('/')
  
      res = {
          "name": api_name,
          "version": api_version,
          "description": api_desc,
          "endpointURL": '{}/{}'.format(base_url, api_path),
          "environment": app_env,
          "swaggerFile": '{}/{}'.format(base_url, api_spec),
          "swaggerUi": '{}/{}/'.format(base_url, api_docs_url),
      }
      if app_env != 'prod':
          req = json.loads(jsonpickle.encode(
              flask.request, unpicklable=False, max_depth=5))
          LOGGER.info('Request: %s', json.dumps(req, sort_keys=True, indent=2))
          res.update({
              "~/request": req
          })
      return res
  