This commit is contained in:
12
src/app.py
12
src/app.py
@ -1,14 +1,14 @@
|
||||
#!/usr/bin/env python3
|
||||
import logging
|
||||
import sentry_sdk
|
||||
from flask import Flask
|
||||
from flask_restful import Api
|
||||
import sentry_sdk
|
||||
from sentry_sdk.integrations.flask import FlaskIntegration
|
||||
import pika
|
||||
|
||||
import rabbitmqqueue
|
||||
from config import *
|
||||
from db import db
|
||||
from resources import *
|
||||
from resources import SampleResource, SampleParameterResource
|
||||
|
||||
"""
|
||||
Main Flask RESTful API
|
||||
@ -37,10 +37,6 @@ db.init_app(app)
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
|
||||
rabbitmq = pika.BlockingConnection(pika.ConnectionParameters(host=RABBITMQ_HOST))
|
||||
rabbitmq_channel = rabbitmq.channel()
|
||||
rabbitmq_channel.queue_declare(RABBITMQ_QUEUE)
|
||||
|
||||
formatter = logging.Formatter(
|
||||
fmt="%(asctime)s - %(levelname)s - %(module)s - %(message)s"
|
||||
)
|
||||
@ -53,7 +49,7 @@ logger.setLevel(logging.DEBUG)
|
||||
logger.addHandler(handler)
|
||||
|
||||
api.add_resource(SampleResource, "/v1/input/sample")
|
||||
api.add_resource(SampleParameterResource, '/v1/input/sample<str:tag>')
|
||||
api.add_resource(SampleParameterResource, '/v1/input/sample/<tag>')
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(
|
||||
|
Reference in New Issue
Block a user