title: oracle query in python - The return type must be a string, dict, tuple
body: <p>I'm trying to show the output of a query on the web api endpoint but it isn't working.</p>
  <p>The code below is returning <em>TypeError: The view function did not return a valid response. The return type must be a string, dict, tuple, Response instance, or WSGI callable, but it was a int</em>.</p>
  <p>I already tried different ways but no luck. What am I missing here?</p>
  <pre><code>from flask import Flask, jsonify, request, render_template
  from flask_cors import CORS
  import cx_Oracle
  import os
  import json
  import logging
  
  app = Flask(__name__)
  app.logger.disabled = True
  log = logging.getLogger('werkzeug')
  log.disabled = True
  
  @app.route('/query')
  def query1():
  
    connection = cx_Oracle.connect(user='superuser', password='mypass1', dsn='moon.my-org.local:1521/db1_sql')
    cursor = connection.cursor()
  
    cursor.execute(&quot;&quot;&quot;SELECT * from users&quot;&quot;&quot;)
  
    result = cursor.fetchone()
    if result == None:
            return(&quot;No results&quot;)
            exit
    else:
            while result:
                    return result[0]
                    result = cursor.fetchone()
  
    cursor.close()
    connection.close()
  
  port = int(os.getenv(&quot;PORT&quot;))
  app.run(host='0.0.0.0', port=port, debug=True)
  </code></pre>