Browse Source

adding org for errors

master
Your Name 4 years ago
parent
commit
f02309ed11
  1. 22
      api.py

22
api.py

@ -137,7 +137,7 @@ def api_args():
# Write to the database # Write to the database
with sqlite3.connect("queermottoapi.db") as con: with sqlite3.connect("queermottoapi.db") as con:
cur = con.cursor() 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() con.commit()
return jsonify(refusal_message) return jsonify(refusal_message)
@ -149,7 +149,7 @@ def api_args():
# Write to the database # Write to the database
with sqlite3.connect("queermottoapi.db") as con: with sqlite3.connect("queermottoapi.db") as con:
cur = con.cursor() 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() con.commit()
return jsonify(refusal_message) return jsonify(refusal_message)
@ -173,18 +173,19 @@ def api_args():
# Write to the database # Write to the database
with sqlite3.connect("queermottoapi.db") as con: with sqlite3.connect("queermottoapi.db") as con:
cur = con.cursor() 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() con.commit()
return jsonify(refusal_message) return jsonify(refusal_message)
else: else:
moment = datetime.datetime.now(tz) moment = datetime.datetime.now(tz)
timestamp = moment.__str__() timestamp = moment.__str__()
refusal_code = 402 refusal_code = 401
refusal_message = build_error_three() refusal_message = build_error_two()
org = "Someone"
# Write to the database # Write to the database
with sqlite3.connect("queermottoapi.db") as con: with sqlite3.connect("queermottoapi.db") as con:
cur = con.cursor() 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() con.commit()
return jsonify(refusal_message) return jsonify(refusal_message)
@ -195,10 +196,11 @@ def error_fourzerozero(e):
timestamp = moment.__str__() timestamp = moment.__str__()
refusal_code = 401 refusal_code = 401
refusal_message = build_error_two() refusal_message = build_error_two()
org = "Someone"
# Write to the database # Write to the database
with sqlite3.connect("queermottoapi.db") as con: with sqlite3.connect("queermottoapi.db") as con:
cur = con.cursor() 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() con.commit()
return jsonify(refusal_message) return jsonify(refusal_message)
@ -208,10 +210,11 @@ def error_fourzerofour(e):
timestamp = moment.__str__() timestamp = moment.__str__()
refusal_code = 401 refusal_code = 401
refusal_message = build_error_two() refusal_message = build_error_two()
org = "Someone"
# Write to the database # Write to the database
with sqlite3.connect("queermottoapi.db") as con: with sqlite3.connect("queermottoapi.db") as con:
cur = con.cursor() 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() con.commit()
return jsonify(refusal_message) return jsonify(refusal_message)
@ -221,10 +224,11 @@ def error_fivezerozero(e):
timestamp = moment.__str__() timestamp = moment.__str__()
refusal_code = 401 refusal_code = 401
refusal_message = build_error_two() refusal_message = build_error_two()
org = "Someone"
# Write to the database # Write to the database
with sqlite3.connect("queermottoapi.db") as con: with sqlite3.connect("queermottoapi.db") as con:
cur = con.cursor() 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() con.commit()
return jsonify(refusal_message) return jsonify(refusal_message)

Loading…
Cancel
Save