adding org for errors

This commit is contained in:
Your Name 2021-01-13 17:24:53 +01:00
parent 94f5a21a7f
commit f02309ed11

22
api.py
View File

@ -137,7 +137,7 @@ def api_args():
# Write to the database
with sqlite3.connect("queermottoapi.db") as con:
cur = con.cursor()
cur.execute("INSERT INTO mottos (TIMESTAMP,SEEDTEXT,REFUSAL_CODE,REFUSAL_MESSAGE) VALUES (?,?,?,?)",(timestamp,seedText,refusal_code,refusal_message) )
cur.execute("INSERT INTO mottos (TIMESTAMP,ORGANISATION,SEEDTEXT,REFUSAL_CODE,REFUSAL_MESSAGE) VALUES (?,?,?,?,?)",(timestamp,org,seedText,refusal_code,refusal_message) )
con.commit()
return jsonify(refusal_message)
@ -149,7 +149,7 @@ def api_args():
# Write to the database
with sqlite3.connect("queermottoapi.db") as con:
cur = con.cursor()
cur.execute("INSERT INTO mottos (TIMESTAMP,SEEDTEXT,REFUSAL_CODE,REFUSAL_MESSAGE) VALUES (?,?,?,?)",(timestamp,seedText,refusal_code,refusal_message) )
cur.execute("INSERT INTO mottos (TIMESTAMP,ORGANISATION,SEEDTEXT,REFUSAL_CODE,REFUSAL_MESSAGE) VALUES (?,?,?,?,?)",(timestamp,org,seedText,refusal_code,refusal_message) )
con.commit()
return jsonify(refusal_message)
@ -173,18 +173,19 @@ def api_args():
# Write to the database
with sqlite3.connect("queermottoapi.db") as con:
cur = con.cursor()
cur.execute("INSERT INTO mottos (TIMESTAMP,SEEDTEXT,REFUSAL_CODE,REFUSAL_MESSAGE) VALUES (?,?,?,?)",(timestamp,seedText,refusal_code,refusal_message) )
cur.execute("INSERT INTO mottos (TIMESTAMP,ORGANISATION,SEEDTEXT,REFUSAL_CODE,REFUSAL_MESSAGE) VALUES (?,?,?,?,?)",(timestamp,org,seedText,refusal_code,refusal_message) )
con.commit()
return jsonify(refusal_message)
else:
moment = datetime.datetime.now(tz)
timestamp = moment.__str__()
refusal_code = 402
refusal_message = build_error_three()
refusal_code = 401
refusal_message = build_error_two()
org = "Someone"
# Write to the database
with sqlite3.connect("queermottoapi.db") as con:
cur = con.cursor()
cur.execute("INSERT INTO mottos (TIMESTAMP,SEEDTEXT,REFUSAL_CODE,REFUSAL_MESSAGE) VALUES (?,?,?,?)",(timestamp,seedText,refusal_code,refusal_message) )
cur.execute("INSERT INTO mottos (TIMESTAMP,ORGANISATION,SEEDTEXT,REFUSAL_CODE,REFUSAL_MESSAGE) VALUES (?,?,?,?,?)",(timestamp,org,seedText,refusal_code,refusal_message) )
con.commit()
return jsonify(refusal_message)
@ -195,10 +196,11 @@ def error_fourzerozero(e):
timestamp = moment.__str__()
refusal_code = 401
refusal_message = build_error_two()
org = "Someone"
# Write to the database
with sqlite3.connect("queermottoapi.db") as con:
cur = con.cursor()
cur.execute("INSERT INTO mottos (TIMESTAMP,SEEDTEXT,REFUSAL_CODE,REFUSAL_MESSAGE) VALUES (?,?,?,?)",(timestamp,seedText,refusal_code,refusal_message) )
cur.execute("INSERT INTO mottos (TIMESTAMP,ORGANISATION,SEEDTEXT,REFUSAL_CODE,REFUSAL_MESSAGE) VALUES (?,?,?,?,?)",(timestamp,org,seedText,refusal_code,refusal_message) )
con.commit()
return jsonify(refusal_message)
@ -208,10 +210,11 @@ def error_fourzerofour(e):
timestamp = moment.__str__()
refusal_code = 401
refusal_message = build_error_two()
org = "Someone"
# Write to the database
with sqlite3.connect("queermottoapi.db") as con:
cur = con.cursor()
cur.execute("INSERT INTO mottos (TIMESTAMP,SEEDTEXT,REFUSAL_CODE,REFUSAL_MESSAGE) VALUES (?,?,?,?)",(timestamp,seedText,refusal_code,refusal_message) )
cur.execute("INSERT INTO mottos (TIMESTAMP,ORGANISATION,SEEDTEXT,REFUSAL_CODE,REFUSAL_MESSAGE) VALUES (?,?,?,?,?)",(timestamp,org,seedText,refusal_code,refusal_message) )
con.commit()
return jsonify(refusal_message)
@ -221,10 +224,11 @@ def error_fivezerozero(e):
timestamp = moment.__str__()
refusal_code = 401
refusal_message = build_error_two()
org = "Someone"
# Write to the database
with sqlite3.connect("queermottoapi.db") as con:
cur = con.cursor()
cur.execute("INSERT INTO mottos (TIMESTAMP,SEEDTEXT,REFUSAL_CODE,REFUSAL_MESSAGE) VALUES (?,?,?,?)",(timestamp,seedText,refusal_code,refusal_message) )
cur.execute("INSERT INTO mottos (TIMESTAMP,ORGANISATION,SEEDTEXT,REFUSAL_CODE,REFUSAL_MESSAGE) VALUES (?,?,?,?,?)",(timestamp,org,seedText,refusal_code,refusal_message) )
con.commit()
return jsonify(refusal_message)