From 61096f0c4fd9f77bd07cbfe6888a686236b6931e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20J=C4=99dyk?= Date: Mon, 31 Jan 2022 17:10:35 +0100 Subject: [PATCH] request logs --- ayct_backend/__init__.py | 8 +++++++- ayct_backend/twitter/__init__.py | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ayct_backend/__init__.py b/ayct_backend/__init__.py index f12cad3..7b60880 100644 --- a/ayct_backend/__init__.py +++ b/ayct_backend/__init__.py @@ -21,13 +21,19 @@ def create_app(): twitter_db.init_app(app) campaign_db.init_app(app) + twitter_db.drop_all(app=app) twitter_db.create_all(app=app) - campaign_db.drop_all(app=app) + twitter_db.drop_all(app=app) campaign_db.create_all(app=app) app.register_blueprint(twitter, url_prefix='/twitter') app.register_blueprint(campaign, url_prefix='/campaign') + @app.before_request + def log_request_info(): + app.logger.debug('Headers: %s', request.headers) + app.logger.debug('Body: %s', request.get_data()) + @app.route('/hello') def hello(): return "Hello world!" diff --git a/ayct_backend/twitter/__init__.py b/ayct_backend/twitter/__init__.py index 7e4615f..4864a7a 100644 --- a/ayct_backend/twitter/__init__.py +++ b/ayct_backend/twitter/__init__.py @@ -1,4 +1,3 @@ -import os from requests_oauthlib import OAuth1Session from flask import Blueprint, Response, current_app, request, jsonify from ayct_backend.twitter.models import *