raena-crawler-engine/hasaki_crawler_engine/hasaki_crawler.py

48 lines
1.2 KiB
Python
Raw Normal View History

2024-03-14 05:16:59 +00:00
import logging
import json
import time
from hasaki_categories import HasakiCategories
from hasaki_category_products import HasakiCategoryProducts
from hasaki_product_info import HasakiProductInfo
##### Looger ######
format = "%(asctime)s: %(message)s"
logging.basicConfig(format=format, level=logging.INFO, datefmt="%Y-%m-%d %H:%M:%S")
config = {}
def main():
# hasaki_categories = HasakiCategories(config)
# hasaki_categories.start_processing()
#
# time.sleep(60)
#
# hasaki_category_products = HasakiCategoryProducts(config)
# hasaki_category_products.start_processing()
#
# time.sleep(60)
hasaki_products = HasakiProductInfo(config)
hasaki_products.start_processing()
if __name__ == "__main__":
logging.info("Starting Hasaki Crawler.......")
try:
logging.info("Loading config file.......")
with open("conf.json", "r") as jsonfile:
config = json.load(jsonfile)
logging.info("Config file loaded.......")
print(config)
main()
except Exception as e:
logging.info("Error: ".format(e))
#logging.info("Cannot load config file. Please check. Exiting......")
#send_mail()
exit(1)