#!bin/python
import json
import lib_zpr

from flask import Flask, jsonify, make_response


app = Flask(__name__)

api_version = 'v1.0'
api_base = str('/zpr/{v}'.format(v=api_version))

@app.errorhandler(404)
def not_found(error):
    return make_response(jsonify({'error': 'Not found'}), 404)

# @app.route('/zpr/job')
# def ls_test():
#     return json.dumps(call('ls'))

@app.route('{a}/job/<backup_host>'.format(a=api_base), methods=['GET'])
def check_job(backup_host):
    job = str(lib_zpr.check_zpr_rsync_job(backup_host))
    return json.dumps(job)

@app.route('{a}/job/duplicity/<backup_host>'.format(a=api_base), methods=['GET'])
def check_offsite_job(backup_host):
    lib_zpr.check_duplicity_job(backup_host, print_output=False)
    return json.dumps(str(lib_zpr.check_duplicity_out[0]))

if __name__ == '__main__':
    app.run(debug=True)

#!bin/python
import json
import lib_zpr

from flask import Flask, jsonify, make_response


app = Flask(__name__)

api_version = 'v1.0'
api_base = str('/zpr/{v}'.format(v=api_version))

@app.errorhandler(404)
def not_found(error):
    return make_response(jsonify({'error': 'Not found'}), 404)

# @app.route('/zpr/job')
# def ls_test():
#     return json.dumps(call('ls'))

@app.route('{a}/job/<backup_host>'.format(a=api_base), methods=['GET'])
def check_job(backup_host):
    job = str(lib_zpr.check_zpr_rsync_job(backup_host))
    return json.dumps(job)

@app.route('{a}/job/duplicity/<backup_host>'.format(a=api_base), methods=['GET'])
def check_offsite_job(backup_host):
    lib_zpr.check_duplicity_job(backup_host, print_output=False)
    return json.dumps(str(lib_zpr.check_duplicity_out[0]))

if __name__ == '__main__':
    app.run(host='127.0.0.1')

Add host and remove debug
Add host and remove debug
