import requests

from flask import Flask, request, Response
from werkzeug.datastructures import Headers

from two1.wallet import Wallet
from two1.bitserv.flask import Payment

NOMINATIM_HOST = 'ec2-52-40-116-115.us-west-2.compute.amazonaws.com'
NOMINATIM_PORT = '80'

app = Flask(__name__)

wallet = Wallet()
payment = Payment(app, wallet)

def do_call(method_name):
    url = 'http://{}:{}/nominatim/{}.php'.format(NOMINATIM_HOST, NOMINATIM_PORT, method_name)
    r = requests.get(
        url=url,
        params=request.args if request.args else None)
    headers = list(r.headers.items())
    resp = Response(
        r.text if r.text else None,
        status = r.status_code,
        headers = headers)
    print(resp)
    return resp

@app.route('/reverse')
@payment.required(5)
def reverse():
    return do_call('reverse')

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5001)

@@ -548,16 +548,116 @@
 e None)%0A
+    return r%0A%0A@app.route('/reverse')%0A@payment.required(5)%0Adef reverse():%0A    r = do_call('reverse')%0A
     head
@@ -839,98 +839,8 @@
 sp%0A%0A
-@app.route('/reverse')%0A@payment.required(5)%0Adef reverse():%0A    return do_call('reverse')%0A%0A
 if _

move response