Skip to content
Snippets Groups Projects
costData.py 430 B
Newer Older
Ethan R Shaw's avatar
Ethan R Shaw committed
from flask import request, Blueprint, jsonify
import psycopg2

costData_bp = Blueprint('costData', __name__)

@costData_bp.route('/costData', methods = ['GET'])
def get_costData():
    conn = psycopg2.connect(database="Team3DB", user="Team3", password="team3", host="138.26.48.83", port="5432")
    cur = conn.cursor()
    all_costData = cur.execute ('SELECT * FROM total_cost_watts;').fetchall()

    return jsonify(all_costData)