Zappa 异步任务导致 Amazon Cloudfront 生成 403 错误请求
Zappa async task results in 403 Bad Request Generated by Amazon Cloudfront
我第一次尝试在我的项目中使用 Zappa 异步任务。我不断收到来自 Amazon cloudfront 的 403 Bad 请求。
这是代码-
@task
def send_email(email_id):
start = datetime.now()
sleep(120)
body = """zappa task started at {}
waited for 100.
mail sent at: {}""".format(str(start), str(datetime.now()))
send_mail("Zappa Task Email", body, settings.EMAIL_HOST_USER, [email_id])
####
class zappa_task(APIView):
def get(self, request, version):
email = request.GET.get('email')
t = datetime.now()
send_email(email)
return httpResponse('Zappa task triggered at: {}, code returned at: {}'.format(str(t), str(datetime.now())))
大家有什么想法吗?
装饰器应该是这样的,
@task(remote_aws_lambda_function_name=("provide the deployed lambda function name here on which it has to run"), remote_aws_region="the region name here")
def send_email(email_id):
我第一次尝试在我的项目中使用 Zappa 异步任务。我不断收到来自 Amazon cloudfront 的 403 Bad 请求。 这是代码-
@task
def send_email(email_id):
start = datetime.now()
sleep(120)
body = """zappa task started at {}
waited for 100.
mail sent at: {}""".format(str(start), str(datetime.now()))
send_mail("Zappa Task Email", body, settings.EMAIL_HOST_USER, [email_id])
####
class zappa_task(APIView):
def get(self, request, version):
email = request.GET.get('email')
t = datetime.now()
send_email(email)
return httpResponse('Zappa task triggered at: {}, code returned at: {}'.format(str(t), str(datetime.now())))
大家有什么想法吗?
装饰器应该是这样的,
@task(remote_aws_lambda_function_name=("provide the deployed lambda function name here on which it has to run"), remote_aws_region="the region name here")
def send_email(email_id):