29 lines
614 B
Python
29 lines
614 B
Python
import flask
|
|
from flask import request
|
|
|
|
from backends import PowerDNSBackend
|
|
from utils import verify_token
|
|
|
|
app = flask.Flask(__name__)
|
|
app.config.from_pyfile('config.cfg')
|
|
|
|
app.backend = PowerDNSBackend(app.config)
|
|
|
|
@app.route('/api/1/add')
|
|
@verify_token
|
|
def add():
|
|
name, type_ = request.args['record'].rsplit(':', 1)
|
|
app.backend.add(name, request.args['value'], type_)
|
|
return 'ok'
|
|
|
|
@app.route('/api/1/delete')
|
|
@verify_token
|
|
def delete():
|
|
name, type_ = request.args['record'].rsplit(':', 1)
|
|
app.backend.delete(name, type_)
|
|
return 'ok'
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app.run(debug=True)
|