Example #1
0
        host=app.config["REDIS_HOST"],
        port=app.config["REDIS_PORT"],
        db=app.config["REDIS_DB"],
        password=app.config["REDIS_PASSWORD"],
    )


app = Flask(__name__, instance_relative_config=False)

app.url_map.converters["objectid"] = ObjectIDConverter


app.config["RETHINKDB_HOST"] = "127.0.0.1"
app.config["RETHINKDB_PORT"] = "28015"
app.config["RETHINKDB_AUTH"] = "password"
app.config["RETHINKDB_DB"] = "stalker"
app.config["LOCAL_CID"] = getfqdn()
app.config["GLOBAL_CLUSTERS"] = None
app.config["REMOTE_TIMEOUT"] = 2
app.config["REGISTER_KEY"] = "itsamario"
app.config["API_KEY"] = "something"
app.config["SECRET_KEY"] = "SuperSecretDevKeyChangeMe!"
app.config["THEMES"] = ["cosmo", "cerulean", "cyborg", "slate", "spacelab", "united", "flatly"]
app.config["CACHE_TTL"] = 10
app.config["GRAPHITE_ENABLE"] = False
app.config["GRAPHITE_HOST"] = "http://localhost/"
app.config["LOG_FILE"] = "/var/log/stalker/stalkerweb.log"
app.config["LOG_NAME"] = "stalkerweb"
app.config["LOG_COUNT"] = 7

app.config.from_envvar("STALKERWEB_CONFIG", silent=True)
Example #2
0
from flask import Flask, jsonify, abort
from flask_rethinkdb import RethinkDB
from flask_restful import Resource, Api, reqparse
from rethinkdb.errors import ReqlOpFailedError

# from eveauth.contrib.flask import authenticate

app = Flask(__name__)
db = RethinkDB(app)
api = Api(app)

# App Settings
app.config["BUNDLE_ERRORS"] = True
app.config["RETHINKDB_HOST"] = os.environ.get("RDB_HOST", "192.168.99.100")
app.config["RETHINKDB_PORT"] = os.environ.get("RDB_PORT", "32197")
app.config["RETHINKDB_DB"] = os.environ.get("RDB_DB", "test")

RDB_TABLE = os.environ.get("RDB_TABLE", "slack_webhooks")


class Webhooks(Resource):
    # @authenticate()
    def get(self, character_id):
        # if request.token['character_id'] != character_id:
        #     abort(403)

        results = r.table(RDB_TABLE).filter(lambda row: row["character"].eq(character_id)).run(db.conn)

        return [{"id": x["id"], "name": x["name"]} for x in results]

    # @authenticate()