-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
417 lines (293 loc) · 11.4 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
from pathlib import Path # https://medium.com/@ageitgey/python-3-quick-tip-the-easy-way-to-deal-with-file-paths-on-windows-mac-and-linux-11a072b58d5f
# import "packages" from flask
from flask import Flask, render_template, request
import requests
import http.client
from flask import render_template
from __init__ import app
# from starter.starter import app_starter
# from algorithm.algorithm import app_algorithm
from app_crud import app_crud
from app_attendance import app_attendance
from app_vidhi import app_vidhi
from app_saumya import app_saumya
from app_arushi import app_arushi
from app_prisha import app_prisha
from app_aryan import app_aryan
# from y2022 import app_y2022
# # create a Flask instance
# app = Flask(__name__)
# app.register_blueprint(app_starter)
# app.register_blueprint(app_algorithm)
app.register_blueprint(app_crud)
app.register_blueprint(app_attendance)
app.register_blueprint(app_vidhi)
app.register_blueprint(app_saumya)
app.register_blueprint(app_arushi)
app.register_blueprint(app_prisha)
app.register_blueprint(app_aryan)
# app.register_blueprint(app_y2022)
# connects default URL of server to render kangaroos.html
@app.route('/home')
def index():
return render_template("index.html")
@app.route('/snake', methods=['GET', 'POST'])
def snake():
return render_template("snake.html")
@app.route('/saumyaapi2', methods=['GET', 'POST'])
def saumyaapi2():
url = "https://recipesapi2.p.rapidapi.com/recipes/tomato%20soup"
querystring = {"maxRecipes":"2"}
headers = {
'x-rapidapi-host': "recipesapi2.p.rapidapi.com",
'x-rapidapi-key': "8d571b2f72msh44f8fd48e083624p19cce1jsnfb1e373c1716"
}
response = requests.request("GET", url, headers=headers, params=querystring)
# return(response.text)
return render_template("api/saumyaapi2.html", stats=response.json())
@app.route('/to_do_list', methods=['GET', 'POST'])
def to_do_list():
return render_template("to_do_list.html")
@app.route('/weather', methods=['GET', 'POST'])
def weather():
url = "https://community-open-weather-map.p.rapidapi.com/weather"
querystring = {"q": "san diego", "lat": "0", "lon": "0", "lang": "en", "units": "imperial"}
headers = {
'x-rapidapi-host': "community-open-weather-map.p.rapidapi.com",
'x-rapidapi-key': "f74ed87200msh995f07c2f92be0bp101c14jsn28a6b622e01b"
}
response = requests.request("GET", url, headers=headers, params=querystring)
return render_template("/weather.html", stats=response.json())
#return response.text
@app.route('/quiz', methods=['GET', 'POST'])
def quiz():
if request.form:
name = request.form.get("name")
if len(name) != 0: # input field has content
return render_template("quiz.html", name1=name)
# starting and empty input default
return render_template("quiz.html", name1="TechFish User")
@app.route('/googlemap/')
def googlemap():
return render_template("locations.html")
@app.route('/registrationform')
def registrationform():
return render_template("registration_form.html")
@app.route('/phonestablets')
def phonestablets():
return render_template("departments/phonestablets.html")
@app.route('/contactus')
def contactus():
return render_template("contactus.html")
@app.route('/tictactoe')
def tictactoe():
return render_template("tic-tac-toe(easylev).html")
@app.route('/contactothers')
def contactothers():
return render_template("contactothers.html")
@app.route('/desktopstvs')
def desktopstvs():
return render_template("departments/desktopstvs.html")
@app.route('/audiodevices')
def audiodevices():
return render_template("departments/audiodevices.html")
@app.route('/aidevices')
def aidevices():
return render_template("departments/aidevices.html")
@app.route("/binary", methods=['GET', 'POST'])
def binary():
if request.form:
bits = request.form.get("bits")
if len(bits) != 0: # input field has content
return render_template("mini labs/binary.html", bits=int(bits))
# starting and empty input default
return render_template("mini labs/binary.html", bits=8)
@app.route("/colors", methods=['GET', 'POST'])
def colors():
return render_template("mini labs/colorcodes.html")
@app.route('/addition')
def addition():
return render_template("mini labs/addition.html")
@app.route('/#')
def login():
return render_template("login.html", user_authenticated=False)
@app.route("/logicgates", methods=['GET', 'POST'])
def logicgates():
return render_template("mini labs/logicgates.html")
@app.route('/')
def home():
return render_template("home.html")
@app.route('/joke', methods=['GET', 'POST'])
def joke():
"""
# use this url to test on and make modification on you own machine
url = "http://127.0.0.1:5222/api/joke"
"""
url = "https://csp.nighthawkcodingsociety.com/api/joke"
response = requests.request("GET", url)
return render_template("API/joke.html", joke=response.json())
@app.route('/jokes', methods=['GET', 'POST'])
def jokes():
"""
# use this url to test on and make modification on you own machine
url = "http://127.0.0.1:5222/api/jokes"
"""
url = "https://csp.nighthawkcodingsociety.com/api/jokes"
response = requests.request("GET", url)
return render_template("API/jokes.html", jokes=response.json())
@app.route('/covid19', methods=['GET', 'POST'])
def covid19():
url = "https://corona-virus-world-and-india-data.p.rapidapi.com/api"
headers = {
'x-rapidapi-key': "dec069b877msh0d9d0827664078cp1a18fajsn2afac35ae063",
'x-rapidapi-host': "corona-virus-world-and-india-data.p.rapidapi.com"
}
response = requests.request("GET", url, headers=headers)
"""
# uncomment this code to test from terminal
world = response.json().get('world_total')
countries = response.json().get('countries_stat')
print(world['total_cases'])
for country in countries:
print(country["country_name"])
"""
return render_template("API/covid19.html", stats=response.json())
# return response.text
@app.route('/rgb/')
def rgb():
path = Path(app.root_path) / "static" / "assets"
return render_template('mini labs/rgb.html', images=image_data(path))
@app.route('/arushirgb/')
def arushirgb():
path = Path(app.root_path) / "static" / "arushiassets"
return render_template('about us/templates/rgb/arushirgb.html', images=arushi_image_data(path))
@app.route('/prishargb/')
def prishargb():
path = Path(app.root_path) / "static" / "prishaassets"
return render_template('about us/templates/rgb/prishrgb.html', images=prisha_image_data(path))
@app.route('/vaishavirgb/')
def vaishavirgb():
path = Path(app.root_path) / "static" / "vaishaviassets"
return render_template('about us/templates/rgb/vaishavirgb.html', images=vaishavi_image_data(path))
@app.route('/siyargb/')
def siyargb():
path = Path(app.root_path) / "static" / "siyaassets"
return render_template('about us/templates/rgb/siyargb.html', images=siya_image_data(path))
@app.route('/AboutUs/', methods=['GET', 'POST'])
def AboutUs():
# submit button has been pushed
if request.form:
name = request.form.get("name")
if len(name) != 0: # input field has content
return render_template("about us/MainAboutUs.html", name1=name)
# starting and empty input default
return render_template("about us/MainAboutUs.html", name1="TechFish User")
# @app.route('/prisha/', methods=['GET', 'POST'])
# def prisha():
# # submit button has been pushed
# if request.form:
# name = request.form.get("name")
# if len(name) != 0: # input field has content
# return render_template("about us/prisha.html", name1=name)
# # starting and empty input default
# return render_template("about us/prisha.html", name1="TechFish User")
#@app.route('/aryan/', methods=['GET', 'POST'])
#def aryan():
# submit button has been pushed
# if request.form:
# name = request.form.get("name")
# if len(name) != 0: # input field has content
# return render_template("about us/aryan.html", name1=name)
# starting and empty input default
#return render_template("about us/aryan.html", name1="TechFish User")
@app.route('/saumyaapi', methods=['GET', 'POST'])
def saumyaapi():
#greet function
#set variables = number; input
# set lat/lon = variable name
url = "https://weatherbit-v1-mashape.p.rapidapi.com/forecast/3hourly"
querystring = {"lat":"35.5","lon":"-78.5"}
headers = {
'x-rapidapi-host': "weatherbit-v1-mashape.p.rapidapi.com",
'x-rapidapi-key': "8d571b2f72msh44f8fd48e083624p19cce1jsnfb1e373c1716"
}
response = requests.request("GET", url, headers=headers, params=querystring)
# return(response.text)
return render_template("api/saumyaapi.html", stats=response.json())
@app.route('/calendar')
def calendar():
return render_template("calendar.html")
@app.route('/aryansapi', methods=['GET', 'POST'])
def aryansapi():
url = "https://allah-name.p.rapidapi.com/name"
headers = {
'x-rapidapi-host': "allah-name.p.rapidapi.com",
'x-rapidapi-key': "a53d1a4acemsh90db192dc27d5f7p1028a2jsn2e483944f85c"
}
response = requests.request("GET", url, headers=headers)
return render_template("api/aryansapi.html", stats=response.json())
@app.route('/asc', methods=['GET', 'POST'])
def asc():
return render_template("api/asc.html")
@app.route('/studytimer', methods=['GET', 'POST'])
def studytimer():
return render_template("studytimer.html")
@app.route('/pagetwo', methods=['GET', 'POST'])
def pagetwo():
return render_template("pagetwo.html")
@app.route('/crud', methods=['GET', 'POST'])
def crud():
return render_template("crud.html")
@app.route('/attendance', methods=['GET', 'POST'])
def attendance():
return render_template("attendance.html")
@app.route('/csp_quiz', methods=['GET', 'POST'])
def csp_quiz():
return render_template("csp_quiz.html")
@app.route('/csp_quiz2', methods=['GET', 'POST'])
def csp_quiz2():
return render_template("csp_quiz2.html")
@app.route('/map', methods=['GET', 'POST'])
def map():
return render_template("map.html")
@app.route('/long_term', methods=['GET', 'POST'])
def long_term():
return render_template("long_term.html")
@app.route('/search', methods=['GET', 'POST'])
def search():
return render_template("search.html")
@app.route('/DNHSinformative', methods=['GET', 'POST'])
def DNHSinformative():
return render_template("DNHSinformative.html")
@app.route('/calender', methods=['GET', 'POST'])
def calender():
return render_template("calendar.html")
@app.route('/chat')
def chat():
return render_template("chat.html")
@app.route('/results', methods=['GET', 'POST'])
def results():
return render_template("results.html")
@app.route('/google_searchbar')
def google_searchbar():
return render_template("google_searchbar.html")
@app.route('/pixel_art')
def pixel_art():
return render_template("pixel_art.html")
@app.route('/FlashCards')
def FlashCards():
return render_template("FlashCards.html")
@app.route('/numb')
def numb():
return render_template("numb.html")
@app.route('/Numbers')
def Numbers():
return render_template("Numbers.html")
@app.route('/mathquiz')
def mathquiz():
return render_template("mathquiz.html")
@app.route('/tictactoeHARD')
def tictactoeHARD():
return render_template("tic-tac-toeHARD.html")
if __name__ == "__main__":
app.run(debug=True, port=5222)