

def handle_post_meter(self, handle, connection, match, data, hdr):
    try:
        user_id = self.metering.register((data['user_id'] if (data and ('user_id' in data)) else None))
        timeout = self.metering.timeout
        status = calvinresponse.OK
    except:
        _log.exception('handle_post_meter')
        status = calvinresponse.BAD_REQUEST
    self.send_response(handle, connection, (json.dumps({
        'user_id': user_id,
        'timeout': timeout,
        'epoch_year': time.gmtime(0).tm_year,
    }) if (status == calvinresponse.OK) else None), status=status)

dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/runtime/north/calvincontrol.py CalvinControl.handle_post_meter/original