mardi 21 janvier 2020

How to interrupt function when cancel from UI in Python?

I have the function extract data like that

@controller.route('/scrap_all_categories')
def scrap_all_categories():   
    result = ETL_jobs.extract_all_category(tiki_info.tiki_url, conn)
    return result

Extract_all_category is a function extract data from a website using BeautifulSoup. So it takes about 30 min to finish and it runs until done job without using interrupt key. And I need create a function to cancel this process. Which functions in Python I can use to interrupt this job.

Thanks.




Aucun commentaire:

Enregistrer un commentaire