Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import azure.functions as func
- import datetime
- import logging
- def main(req: func.HttpRequest) -> func.HttpResponse:
- logging.info('Python HTTP trigger function processed a request.')
- name = req.params.get('name')
- id = req.params.get('id')
- if not name:
- try:
- req_body = req.get_json()
- except ValueError:
- pass
- else:
- name = req_body.get('name')
- if not id:
- try:
- req_body = req.get_json()
- except ValueError:
- pass
- else:
- id = req_body.get('id')
- if name and id:
- current_time = datetime.datetime.now().strftime("%Y-%m-%d")
- response_message = f" {id}{name} {current_time} "
- return func.HttpResponse(response_message)
- else:
- return func.HttpResponse(
- "Need query string",
- status_code=400
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement