mardi 16 mars 2021

Send api request every x minutes and update context with status

I am trying to make a website, where user can start a task on a button click, which will send an api request every x seconds/minutes. Api request gets a list of offers as a response and the task will check if the api request is the same as before.

If it is then then i want to show status on my page as: "No offers were found, still searching" and if the api response is different the status changes to: "I found an offer"

I wanted to make that process in the background and without need to refresh the page by user. I want the context["status"] to be automatically updated when new offer is found.

I tried to achieve this with threading but the page keep on loading as a task is working.

Every idea is appreciated. Thanks!




Aucun commentaire:

Enregistrer un commentaire