@access_control.ValidXsrfTokenRequired
  @access_control.ActiveGaSuperProxyUser
  def post(self):
    query_form_input = {
        'name': self.request.get('name'),
        'request': self.request.get('request'),
        'refresh_interval': self.request.get('refresh_interval')
    }

    query_form_input = query_helper.ValidateApiQuery(query_form_input)

    if not query_form_input:
      self.redirect(co.LINKS['owner_index'])

    api_query = query_helper.BuildApiQuery(**query_form_input)

    if self.request.get('test_query'):
      test_response = query_helper.FetchApiQueryResponse(api_query)

      template_values = {
          'test_response': test_response,
          'name': api_query.name,
          'request': api_query.request,
          'refresh_interval': api_query.refresh_interval,
          'timezone': co.TIMEZONE,
          'xsrf_token': access_control.GetXsrfToken()
      }

      self.RenderHtmlTemplate('create.html', template_values)
      return

    elif self.request.get('create_query'):
      query_helper.SaveApiQuery(api_query)

    elif self.request.get('create_run_query'):
      query_helper.ScheduleAndSaveApiQuery(api_query)

    api_query_links = template_helper.GetLinksForTemplate(
        api_query, self.request.host_url)
    self.redirect(api_query_links.get('manage_link', '/'))
Validates and tests/saves the API Query to the datastore.
dataset/ETHPy150Open googleanalytics/google-analytics-super-proxy/src/controllers/owner.py/CreateQueryHandler.post