text: #
  #
  # main() will be run when you invoke this action
  #
  # @param Cloud Functions actions accept a single parameter, which must be a JSON object.
  #
  # @return The output of this action, which must be a JSON object.
  #
  #
  from cloudant.client import Cloudant
  from cloudant.error import CloudantException
  import requests
  
  def main(dict):
      databaseName = "reviews"
  
      try:
          client = Cloudant.iam(
              account_name=dict["COUCH_USERNAME"],
              api_key=dict["IAM_API_KEY"],
              connect=True,
          )
          database = client[databaseName]
          if "review" in dict:
              result_data = database.create_document(dict["review"])
              print("result_data", result_data)
              return {"success": "review added successfully"}
          else:
              return {"error": "review data is not added"}
          print("records: {0}".format(result))
      except CloudantException as ce:
          print("unable to connect")
          return {"error": ce}
      except (requests.exceptions.RequestException, ConnectionResetError) as err:
          print("connection error")
          return {"error": err}
  