mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 17:38:54 +00:00
Events end point.
This commit is contained in:
parent
718577f565
commit
c84f18449b
@ -17,6 +17,7 @@ from flask.ext.restful import Resource, abort
|
||||
from flask_login import current_user, login_user, logout_user
|
||||
|
||||
import sqlparse
|
||||
import events
|
||||
from permissions import require_permission
|
||||
from redash import settings, utils
|
||||
from redash import data
|
||||
@ -129,6 +130,16 @@ class BaseResource(Resource):
|
||||
return current_user._get_current_object()
|
||||
|
||||
|
||||
class EventAPI(BaseResource):
|
||||
def post(self):
|
||||
events_list = request.get_json(force=True)
|
||||
for event in events_list:
|
||||
events.record_event(event)
|
||||
|
||||
|
||||
api.add_resource(EventAPI, '/api/events', endpoint='events')
|
||||
|
||||
|
||||
class DataSourceListAPI(BaseResource):
|
||||
def get(self):
|
||||
data_sources = [ds.to_dict() for ds in models.DataSource.select()]
|
||||
|
8
redash/events.py
Normal file
8
redash/events.py
Normal file
@ -0,0 +1,8 @@
|
||||
import logging
|
||||
import json
|
||||
|
||||
logger = logging.getLogger("events")
|
||||
|
||||
|
||||
def record_event(event):
|
||||
logger.info(json.dumps(event))
|
Loading…
Reference in New Issue
Block a user