|
|
|
@ -1,34 +1,2 @@
|
|
|
|
|
#!/usr/bin/env python
|
|
|
|
|
"""Part of the Weir project.
|
|
|
|
|
This will listen on two endpoints, and when data is
|
|
|
|
|
posted to the proper one, matching a particular format,
|
|
|
|
|
it will save that data to a local sqlite3 db."""
|
|
|
|
|
"""Part of the Weir project."""
|
|
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
import warren
|
|
|
|
|
from flask import Flask, redirect, url_for, request
|
|
|
|
|
|
|
|
|
|
__version__ = "0.1.0"
|
|
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
|
|
|
dbpath = "warren.db"
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
|
|
|
|
@app.route('/')
|
|
|
|
|
def test():
|
|
|
|
|
return 'the website is up you little bitch'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/weir',methods = ['POST'])
|
|
|
|
|
def weir():
|
|
|
|
|
""""""
|
|
|
|
|
try:
|
|
|
|
|
python_dict = request.get_json()
|
|
|
|
|
warren.write_to_db(python_dict, "warren.db")
|
|
|
|
|
return "OK"
|
|
|
|
|
except:
|
|
|
|
|
return "Error.", 400
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
app.run(debug = True)
|
|
|
|
|