[Python] Send API request every x minutes and update context with status

Discussão em 'Python' iniciado por Stack, Agosto 10, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to make a web site, where user can start a task on a button click, which will send an API request every x seconds/minutes. The 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.

    Continue reading...

Compartilhe esta Página