I'm REALLY not sure this is how its supposed to be done. Trying some stuff to get the supporting cast of tooling to work.master
parent
0c37276d11
commit
20f44c8a8f
@ -0,0 +1,34 @@
|
||||
#!/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."""
|
||||
|
||||
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)
|
Reference in new issue