from scraper import do_scrape import settings import time import sys import traceback if __name__ == "__main__": while True: print("{}: Starting scraping cycle".format(time.ctime())) try: do_scrape() except KeyboardInterrupt: print("Exiting...") sys.exit(1) except Exception as exc: print("Error: ", sys.exc_info()[0]) traceback.print_exc() else: print("{}: Successfully finished scraping".format(time.ctime())) time.sleep(settings.SLEEP_INTERVAL)
import time import scraper import config print("Running Bird of the Year Scraper") if __name__ == "__main__": while True: scraper.do_scrape(config.url, config.outfile) time.sleep(config.period)
from scraper import do_scrape, get_df import settings import time import sys import traceback if __name__ == "__main__": while True: print("{}: Starting scrape cycle".format(time.ctime())) try: x = do_scrape() except KeyboardInterrupt: print("Exiting....") df = get_df() df.to_excel( r'C:\Users\sdoggett\Documents\GitHub\apartment-finder\Test\results.xlsx' ) sys.exit(1) except Exception: print("Error with the scraping:", sys.exc_info()[0]) traceback.print_exc() sys.exit(1) else: print("{}: Successfully finished scraping".format(time.ctime())) df = get_df() df.to_excel( r'C:\Users\sdoggett\Documents\GitHub\apartment-finder\Test\results.xlsx' ) break
from scraper import do_scrape import settings import time import sys import traceback if __name__ == "__main__": while True: print("{}: Starting scrape cycle".format(time.ctime())) try: do_scrape() except KeyboardInterrupt: print("Exiting....") sys.exit(1) except Exception as exc: print("Error with the scraping:", sys.exc_info()[0]) traceback.print_exc() else: print("{}: Successfully finished scraping".format(time.ctime())) time.sleep(settings.SLEEP_INTERVAL)