Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
import os
import datetime
import json
from process import start_proc
from process import write_empty
from flask import Flask
from flask import request
from flask import make_response
from flask import Response
from flask import jsonify
from flask import send_from_directory
app = Flask(__name__)
# 404 Not Found - Nothing at the URL
# 405 Method Not Allowed - Wrong URL, not a POST accepting URL
# 500 - Server error - Something is broken in your code
apikey = "d7N^}r4;spD3zSn#&u)Gg#:a/"
def index():
return open("html/index.html", "r").read()
@app.route('/time', methods=['GET','POST'])
def subdomain():
return '\n\nThe time is: ' + str(
def help():
return open("html/help.html", "r").read()
def files():
return open("html/files.html", "r").read()
def dev():
return open("html/dev.html", "r").read()
def privacy():
return open("html/privacy.html", "r").read()
@app.route('/api', methods=['GET','POST'])
def webhook():
if request.method == 'POST':
req = request.get_json(force=True)
password = request.headers['password']
if password != apikey:
print("bad api key")
return {"fulfillmentText": "Bad API Key. Please use a legitament request."}, 401
intent = req["queryResult"]["intent"]["displayName"]
text = req["queryResult"]["queryText"]
sessionID = req["session"]
if intent == "start":
results = {"fulfillmentText": "Okay, start the bomb now. Complete data entry first."}
results = start_proc(req, text, sessionID)
return (jsonify(results))
return open("html/api.html", "r").read()
if __name__ == '__main__':
port = int(os.getenv('PORT', 5000))
print("Starting app on port %d" % port), port=port, host='')