Compare commits

..

No commits in common. "v5" and "main" have entirely different histories.
v5 ... main

3 changed files with 2 additions and 25 deletions

View File

@ -1 +1,2 @@
# python hello-world # 9511e101cc9548d7b4d700fd9d407e26

22
main.py
View File

@ -1,22 +0,0 @@
from flask import jsonify
import json
def main(request):
request_json = request.get_json(silent=True, force=True)
print(data)
# :white_check_mark: Check if body was parsed successfully
if request_json is None:
return jsonify({"error": "Invalid or missing JSON in request body."}), 400
name = request_json.get("name")
salary = request_json.get("salary")
# :white_check_mark: Validate input fields
if not name or not isinstance(salary, (int, float)):
return jsonify({
"error": "Invalid input. 'name' must be a string and 'salary' must be a number."
}), 400
raise_percentage = 15
expected_raise = salary * (raise_percentage / 100)
new_salary = salary + expected_raise
return jsonify({
"expected_raise": round(expected_raise, 2),
})

View File

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