summaryrefslogtreecommitdiff
path: root/util/server.py
blob: de71c9165bd511bb51b08e2b3b120ae9996f4ece (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
##
# This file is part of GNU TALER.
# Copyright (C) 2014-2017 INRIA
#
# TALER is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free Software
# Foundation; either version 2.1, or (at your option) any later version.
#
# TALER is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along with
# GNU TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
#
# @author Florian Dold
# @author Marcello Stanisci
# @brief Simple server that logs what it gets.

import urllib.parse
from urllib.parse import urljoin, quote, urlencode
import logging
import os
import traceback
import uuid
import flask
import json

BASE_DIR = os.path.dirname(os.path.abspath(__file__))
app = flask.Flask(__name__, template_folder=BASE_DIR)

LOGGER = logging.getLogger(__name__)
app.config.from_object(__name__)

##
# Serve the main index page.
#
# @return response object of the index page.
@app.route("/", defaults={"path": ""}, methods=["GET", "POST"])
@app.route("/<path:path>", methods=["GET", "POST"])
def index(path):

    if "POST" == flask.request.method:
        body = flask.request.get_data().decode("utf-8")
        print("LOGGING REQUEST BODY:")
        # print(json.dumps(body, indent=1))
        print(body)
    
    return "ebicstest1"