@post('/worker/<worker_id>/reply_data/<socket_id:int>',
      apply=AuthenticatedPlugin())
def reply_data(worker_id, socket_id):
    """
    Replies with a stream of data to the given socket ID. This reply mechanism
    works through 2 messages sent by this method: the first message is a header
    message containing metadata. The second message streams the actual data in.

    The contents of the first message are parsed from the header_message query
    parameter, which should be in JSON format.

    The contents of the second message go in the body of the HTTP request.
    """
    if not request.query in 'header_message':
        abort(httplib.BAD_REQUEST, 'Missing header message.')

    try:
        header_message = json.loads(request.query.header_message)
    except ValueError:
        abort(httplib.BAD_REQUEST, 'Header message should be in JSON format.') 

    check_reply_permission(worker_id, socket_id)
    local.worker_model.send_json_message(socket_id, header_message, 60, autoretry=False)
    local.worker_model.send_stream(socket_id, request['wsgi.input'], 60)
dataset/ETHPy150Open codalab/codalab-cli/codalab/rest/worker.py/reply_data/swapped operands of `in`