initial save of my chatGPT coding
This commit is contained in:
25
data-arbiter-todo
Normal file
25
data-arbiter-todo
Normal file
@ -0,0 +1,25 @@
|
||||
from flask import Flask
|
||||
import sqlite3
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
# Create a route for the web server
|
||||
@app.route('/')
|
||||
def serve_data():
|
||||
# Connect to the database
|
||||
db = sqlite3.connect("btc_timeseries.db")
|
||||
|
||||
# Fetch the data from the database
|
||||
cursor = db.execute("SELECT * FROM timeseries")
|
||||
data = cursor.fetchall()
|
||||
|
||||
# Convert the data to JSON format
|
||||
data_json = json.dumps(data)
|
||||
|
||||
# Return the data as a response to the request
|
||||
return data_json
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Run the web server
|
||||
app.run()
|
||||
|
Reference in New Issue
Block a user