【问题标题】:Zappa async task results in 403 Bad Request Generated by Amazon CloudfrontZappa 异步任务导致 Amazon Cloudfront 生成 403 Bad Request
【发布时间】:2020-01-20 14:46:40
【问题描述】:

我第一次尝试在我的项目中使用 Zappa Async 任务。我不断收到来自 Amazon Cloudfront 的 403 Bad request。 这是代码-

@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())))

有什么想法吗?

【问题讨论】:

    标签: aws-lambda amazon-cloudfront zappa


    【解决方案1】:

    装饰器应该是这样的,

    @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):
    

    【讨论】:

      猜你喜欢
      • 2019-09-28
      • 1970-01-01
      • 2021-11-04
      • 2019-12-09
      • 2012-04-25
      • 2018-09-21
      • 1970-01-01
      • 2021-10-10
      • 1970-01-01
      相关资源
      最近更新 更多