def lambdaSingleQuery(event, _):
    key, value = Event.from_dict(event).firstKey()
    try:
        result = ProductDatabase.singleProductQuery({key: value}).to_dict()
    except Exception as e:
        return Response.returnError(f'{e}')
    return Response.returnSuccess(body=result)
def lambdaUpdateS3(event, _):
    inputKeyName = Event.from_dict(event).key()
    try:
        updateResult = ProductDatabase.updateS3Input(
            inputBucketName=INPUT_BUCKET_NAME, key=inputKeyName)
    except:
        ProductDatabase.notify(f'error updating with s3 {errorString()}')
        return Response.returnError(errorString())

    ProductDatabase.notify(f'success update {updateResult}')
    return Response.getReturn(body=updateResult)
Пример #3
0
def lineBot(event, *args):
    e = Event.from_dict(event)
    body = e.getBody()
    try:
        replyToken = getReplyToken(body)
    except:
        return Response.getReturn(statusCode=400,
                                  body={'error': 'cant get reply token'})
    try:
        sendReply(replyToken, ACCESSTOKEN)
    except:
        return Response.getReturn(statusCode=400,
                                  body={'error': 'response token not valid'})
    response = {'replyToken': replyToken}

    return Response.getReturn(body=response,
                              statusCode=200,
                              headers={'hello': 'hello'})