Changeset - 72962eef0d3a
[Not reviewed]
default
0 2 0
Dennis Fink - 11 years ago 2013-11-18 21:12:48
dennis.fink@c3l.lu
updated ennstatus
2 files changed with 8 insertions and 1 deletions:
0 comments (0 inline, 0 general)
ennstatus/__init__.py
Show inline comments
 
from flask import Flask
 
from flask import Flask, redirect, url_for
 
from flask_bootstrap import Bootstrap
 
from flask.ext.compress import Compress
 
#from flask_sslify import SSLify
 

	
 
from ennstatus.log import init_logging
 

	
 
@@ -21,9 +21,14 @@ from ennstatus.stats.views import stats_
 
app.register_blueprint(root_page)
 
app.register_blueprint(api_page, url_prefix='/api')
 
app.register_blueprint(donate_page, url_prefix='/donate')
 
app.register_blueprint(status_page, url_prefix='/status')
 
app.register_blueprint(stats_page, url_prefix='/stats')
 

	
 

	
 
@app.errorhandler(404)
 
def page_not_found(e):
 
    return redirect(url_for('donate.index'))
 

	
 
init_logging(app)
 

	
 
application = app
ennstatus/api/views.py
Show inline comments
 
@@ -35,16 +35,18 @@ def update():
 

	
 
    if request.remote_addr not in accepted_ips:
 
        current_app.logger.warn("Unallowed IP %s tried to update data!"
 
                                % ip)
 
        return 'IP not allowed!\n', 403, {'Content-Type': 'text/plain'}
 

	
 
    current_app.logger.info(str(json))    
 
    server = update_server(server=json, ip=ip)
 

	
 
    if server:
 
        current_app.logger.info('Return result')
 
        current_app.logger.info(str(server))
 
        return (jsonify(server), 201,
 
                {'Location': '/api/export/json/single?server_name=%s'
 
                 % server['server_name']})
 

	
 
    else:
 
        current_app.logger.error("Unexpected error: %s" % server,
0 comments (0 inline, 0 general)