Skip to content

Instantly share code, notes, and snippets.

@stumped2
Last active August 29, 2015 13:58
Show Gist options
  • Save stumped2/10428763 to your computer and use it in GitHub Desktop.
Save stumped2/10428763 to your computer and use it in GitHub Desktop.
Directory Provider
import json
import redis
import requests
from flask import Flask, session, request, abort, jsonify, render_template, redirect
from lepl.apps.rfc3696 import Email
from base64 import b64decode
app = Flask(__name__)
app.config.from_object('config')
@app.route('/store', methods=["GET"])
def store():
session.permanent = True
if verify_store_args(request.args):
data = []
ia = request.args.getlist('Persona')
privly = request.args.getlist('Privly')
email_key = get_email_ia(ia[0])
pgp_key = get_pgp_ia(privly[0])
if email_key is None:
abort(400)
if pgp_key is None:
abort(400)
data.append(ia[0])
data.append(privly[0])
print email_key
app.config['CACHE'].set(email_key, json.dumps(data))
app.config['CACHE'].set(pgp_key, json.dumps(data))
return jsonify({'success': True})
else:
abort(400)
@app.route('/hello', methods=["GET"])
def hello():
session.permanent = True
print "Hello"
return jsonify({'success': True})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment