58 lines
2.9 KiB
Python
58 lines
2.9 KiB
Python
#Szefowe Zadanka
|
|
#Created by Kacper Kostka from CubeSoftware
|
|
#-------------------------------
|
|
#Copyright (c) 2021-2022 CubeSoftware
|
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the #Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the #Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A #PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION #OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
import requests
|
|
import json
|
|
|
|
url = "http://localhost:5000"
|
|
|
|
def create_test(name, subject, date, topic):
|
|
data = {"name": name, "subject": subject, "date": date, "topic": topic}
|
|
response = requests.post(url + "/newtest", json=data)
|
|
return response.json()
|
|
|
|
def create_quiz_answer(name, author, subject, question, week, answer):
|
|
data = {"name": name, "author": author, "subject": subject, "question": question, "week": week, "answer": answer}
|
|
response = requests.post(url + "/newquizanswer", json=data)
|
|
return response.json()
|
|
|
|
def create_excersise_answer(name, author, subject, week, answer):
|
|
data = {"name": name, "author": author, "subject": subject, "week": week, "answer": answer}
|
|
response = requests.post(url + "/newexcersiseanswer", json=data)
|
|
return response.json()
|
|
|
|
def get_last_6_tests():
|
|
response = requests.get(url + "/last6tests")
|
|
return response.json()
|
|
|
|
def get_all_tests():
|
|
response = requests.get(url + "/alltests")
|
|
return response.json()
|
|
|
|
def get_all_quiz_answers():
|
|
response = requests.get(url + "/allquizanswers")
|
|
return response.json()
|
|
|
|
def get_all_quiz_answers_with_week(week):
|
|
response = requests.get(url + "/allquizanswers/" + week)
|
|
return response.json()
|
|
|
|
def get_all_excersise_answers():
|
|
response = requests.get(url + "/allexcersiseanswers")
|
|
return response.json()
|
|
|
|
def get_all_excersise_answers_with_week_and_subject(week, subject):
|
|
response = requests.get(url + "/allexcersiseanswers/" + week + "/" + subject)
|
|
return response.json()
|
|
|
|
def get_all_quiz_answers_with_week_in_html(week):
|
|
html = ""
|
|
for quizanswer in get_all_quiz_answers_with_week(week):
|
|
html += "______________ Przedmiot: " + quizanswer["subject"] + "| Polecenie: " + quizanswer["question"] + "| Odpowiedź: " + quizanswer["answer"] + "_______________" + '\n'
|
|
return html
|