Example #1
1
def create_api_app(config=None):
    app = Flask(__name__)

    if config:
        app.config.from_pyfile(config)

    app.config["JSONSCHEMA_DIR"] = os.path.abspath("doorbot/views/api/schemas")

    app.url_map.strict_slashes = False

    jsonschema.init_app(app)
    db.init_app(app)

    from .container import container

    container.init_app(app)

    from .views.api import account, auth, devices, doors, integrations, notifications, people
    from .views.api.lib.json_serializer import ApiJsonEncoder

    app.json_encoder = ApiJsonEncoder
    app.register_blueprint(auth)
    app.register_blueprint(account)
    app.register_blueprint(devices)
    app.register_blueprint(doors)
    app.register_blueprint(integrations)
    app.register_blueprint(notifications)
    app.register_blueprint(people)

    return app
Example #2
0
import json
import ecc
from ecc import ECCurve, ECPoint
import os
import random
import sys
import ecdl
import util
from util import ECDLPParams

from pprint import pprint
from flask import Flask, jsonify, request
from flask_jsonschema import JsonSchema, ValidationError

app = Flask(__name__)
app.config["JSONSCHEMA_DIR"] = os.path.join(app.root_path, "/")
app.config["PROPAGATE_EXCEPTIONS"] = True

jsonschema = JsonSchema(app)

NUM_R_POINTS = 32

# Global dictionary of contexts
_ctx = {}


"""
Look up a context based on id
"""