繁体   English   中英

如何在 AWS Z04A7DA3C5B04CAD85DA1EEBB923 中使用 Python 调用 HTTP 云 function?

[英]How to call an HTTP cloud function using Python in AWS Lambda?

I am trying to send JSON data from AWS S3 to a google cloud function, through a lambda function (Python). A JSON file being added to S3 will trigger the lambda function, which will execute a POST event that sends the contents of the JSON file to a google cloud function.

我知道这是可能的,因为在这篇文章中引用了它,但是没有任何解释或代码可以让我开始。

I know how to set up a lambda function, but I don't know how to make a POST event to send data to the URL of a cloud function. 有人能指出我正确的方向吗?

确保您的云 function 是onRequest类型,因为如果没有 Firebase 模块,您将无法调用onCall

onRequest 示例:

exports.addMessage = functions.https.onRequest(async (req, res) => {
  // Grab the text parameter.
  const original = req.query.text;
  // Push the new message into Firestore using the Firebase Admin SDK.
  const writeResult = await admin.firestore().collection('messages').add({original: original});
  // Send back a message that we've successfully written the message
  res.json({result: `Message with ID: ${writeResult.id} added.`});
});

如何调用云 function: https://firebase.google.com/docs/functions/http-events#invoke_an_http_function

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM