Some test

This commit is contained in:
Stefano Assenzo 2023-02-12 11:39:23 +00:00 committed by GitHub
parent f908f4c116
commit ef80a64b12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

6
app.py
View File

@ -1,5 +1,5 @@
from urllib.request import Request, urlopen
from flask import Flask, render_template, url_for, request, redirect, session, flash
from flask import Flask, render_template, url_for, request, redirect, session, flash, jsonify
from flask_pymongo import PyMongo
from dotenv import load_dotenv
import bcrypt
@ -24,6 +24,9 @@ app = Flask(__name__)
app.secret_key = "testing"
PASSWORD_MONGODB = os.getenv('PASSWORD_MONGODB') #Password for MongoDB
URL_MONGODB = os.getenv('URL_MONGODB') #URL for MongoDB
client = MongoClient("mongodb+srv://elci:" + urllib.parse.quote_plus(PASSWORD_MONGODB) + URL_MONGODB) #Connect to MongoDB
database = client["website-class"] #Database name
collection = database["school-time-table"] #Collection school time table current
@app.route('/')
def homepage():
@ -39,6 +42,7 @@ def orario():
url = "http://127.0.0.1:5000"
response = Request(url, headers={"User-Agent": "Mozilla/5.0"})
webpage = urlopen(response).read()
# Take all data from mongodb
dict = list(json.loads(webpage))
number = str(range(0,7))
day = str(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"])