24 lines
709 B
Python
24 lines
709 B
Python
#!/scrapy/venvs/amznMailConverter/bin/python
|
|
|
|
import time
|
|
import logging
|
|
import os
|
|
from webSimple import generate_pdf_list_html
|
|
from email_pdf_downloader import read_emails
|
|
|
|
def run_daemon():
|
|
while True:
|
|
try:
|
|
read_emails()
|
|
logging.info("Finished checking emails. Sleeping for 1 minutes.")
|
|
except Exception as e:
|
|
logging.error(f"An error occurred: {e}")
|
|
|
|
directory = '/scrapy/amznMailConverter/data'
|
|
output_file = os.path.join(directory, "/scrapy/amznMailConverter/index.html")
|
|
generate_pdf_list_html(directory, output_file)
|
|
time.sleep(60) # Sleep for 1 minute between checks
|
|
|
|
if __name__ == "__main__":
|
|
run_daemon()
|