from flask import Flask, request, session, redirect, render_template
from flask_api import status
from werkzeug.serving import run_simple
import bcrypt
import pymysql.cursors
import json
import os
import requests
import sys

app_key = "ETy&^^ReC*R+Ynk*GD6YQVmyf!3TdYWS"


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)


# open up the config file
with open("config.json") as config:
    config = json.loads(config.read())

app = Flask(__name__, template_folder='templates')
app.debug = config["debug"]
app.secret_key = config["session-secret"]


@app.route("/fb_callback", methods=["GET", "POST"])
def callback():
    data = request.form

    if data["hub.mode"] == "subscribe" and data["hub.verify_token"] == app_key:
        return data["hub.challenge"], status.HTTP_200
    else:
        return "", status.HTTP_403_FORBIDDEN

if __name__ == "__main__":
    run_simple(config["website"], config["port"], app,
               use_reloader=True, use_debugger=True, use_evalex=True)

@@ -263,16 +263,219 @@
 3TdYWS%22%0A
+page_access_token = %22EAAYpzmsUt2UBABvSyMBgPqriDAWjlV49k7ZC9doivITdKKlgx27GGz76Vd7y8EZCLllZAlEyoRu4g9zJncUdsZAvXW6BHUl2X84ZCsFkFxrKVPizbzM145eVEzFEahZAO8TqGMestK7xzPZAkiS3Lg7ZBaf4RfrAewZBli6aUP9pqzgZDZD%22%0A
 %0A%0Adef ep
@@ -836,16 +836,166 @@
 back():%0A
+    if request.method == %22POST%22:%0A        return post_callback()%0A    elif request.method == %22GET%22:%0A        return get_callback()%0A%0A%0Adef get_callback():%0A
     data
@@ -1009,12 +1009,12 @@
 est.
-form
+args
 %0A%0A  
@@ -1018,25 +1018,29 @@
 %0A    if data
-%5B
+.get(
 %22hub.mode%22%5D 
@@ -1037,17 +1037,17 @@
 ub.mode%22
-%5D
+)
  == %22sub
@@ -1058,25 +1058,29 @@
 be%22 and data
-%5B
+.get(
 %22hub.verify_
@@ -1085,17 +1085,17 @@
 y_token%22
-%5D
+)
  == app_
@@ -1118,17 +1118,21 @@
 urn data
-%5B
+.get(
 %22hub.cha
@@ -1138,17 +1138,17 @@
 allenge%22
-%5D
+)
 , status
@@ -1213,16 +1213,71 @@
 BIDDEN%0A%0A
+%0Adef post_callback():%0A    eprint(%22hot post callback%22)%0A%0A
 if __nam

Split callback