@login_required
@require_POST
def proxy_keen(request, project_id):
    from utils.td_helper import send_td_event
    project = get_object_or_404(Project, pk=project_id)

    acceptable_events = {
        'app_install_succeeded',
        'websocket_connection_failed',
        'app_install_failed',
        'app_log_view',
        'app_log_clear',
        'app_log_download',
        'app_logged_crash',
        'sdk_screenshot_success',
        'sdk_screenshot_failed',
        'cloudpebble_created_ui_layout',
        'cloudpebble_ib_displayed',
        'cloudpebble_ib_created_layer',
        'cloudpebble_android_beta_modal',
        'cloudpebble_android_beta_download',
        'qemu_launched',
        'cloudpebble_timeline_displayed',
        'sdk_pin_inserted',
        'sdk_pin_deleted',
        'cloudpebble_fuzzyprompt_action'
    }

    event = request.POST['event']
    if event not in acceptable_events:
        return json_failure("nope.")

    data = {}
    if 'data' in request.POST:
        data['data'] = json.loads(request.POST['data'])

    if 'device' in request.POST:
        data['device'] = json.loads(request.POST['device'])

    collections = ['cloudpebble', 'sdk']
    if 'collections' in request.POST:
        collections = list(set(collections) & set(json.loads(request.POST['collections'])))

    if len(data.items()) == 0:
        data = None

    send_td_event(event, data=data, request=request, project=project)
    return json_response({})
dataset/ETHPy150Open pebble/cloudpebble/ide/api/__init__.py/proxy_keen/original