Automatic push from FunctionsAPI

This commit is contained in:
FunctionsAPI 2025-01-15 07:01:09 +00:00
parent f7c4af37fb
commit 3cd3945184
3 changed files with 21 additions and 2 deletions

View File

@ -1,2 +1 @@
# ce6c2210d40645a7b9e9ee15d93ab0a3 # python hello-world

18
main.py Normal file
View File

@ -0,0 +1,18 @@
import json
def main(request):
# Parse the input from the request (assumes JSON input)
try:
request_json = request.get_json(silent=True)
num1 = request_json.get('num1')
num2 = request_json.get('num2')
# Ensure numbers are provided
if num1 is None or num2 is None:
return "Missing 'num1' or 'num2'", 400
# Add the numbers
result = float(num1) + float(num2)
return json.dumps({"result": result}), 200
except Exception as e:
return f"Error: {str(e)}", 500

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
functions-framework==1.4.3
markupsafe==2.0.1