I want to trigger HttpTrigger function every day at 9.00 PM using the Timer trigger. Is it possible in Azure function for python?
I am not able to understand how can I implement it? Is there any way to implement the above scenario?
Please check the below code.
HttpTrigger Function Code
import logging
import azure.functions as func
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
name = req.params.get('name')
if not name:
try:
req_body = req.get_json()
except ValueError:
pass
else:
name = req_body.get('name')
logging.info(name)
if name:
return func.HttpResponse(f"Hello {name}!")
else:
return func.HttpResponse(
"Please pass a name on the query string or in the request body",
status_code=400
)
TimerTrigger Function Code :-
import datetime
import logging
import requests
import azure.functions as func
def main(mytimer: func.TimerRequest) -> None:
utc_timestamp = datetime.datetime.utcnow().replace(
tzinfo=datetime.timezone.utc).isoformat()
if mytimer.past_due:
logging.info('The timer is past due!')
logging.info('Python timer trigger function ran at %s', utc_timestamp)
url = '<My URL>'
PARAMS = {"name": "Akshay"}
response_decoded_json = requests.post(url=url, params =PARAMS)
print(response_decoded_json.text)
logging.info("Result is :- ")
logging.info(response_decoded_json.text)




The timer is past due!issue in TimerTrigger function.