Exemplo n.º 1
0
    def __init__(self) -> None:
        self.args = self._parse_arguments()
        self.logger = logger.set_up_script_logger(__file__, log_file=self.args.log_file, log_level=self.args.log_level)
        self.connection = utils.create_connection()

        if not self.args.dry_run:
            utils.check_db_tables(self.connection, ["calendar", "event_url", "event_html", "event_data"])
Exemplo n.º 2
0
    def __init__(self) -> None:
        self.args = self._parse_arguments()
        self.logger = logger.set_up_script_logger(__file__, log_file=self.args.log_file, log_level=self.args.log_level)
        self.connection = utils.create_connection()

        if not self.args.dry_run:
            utils.check_file(INPUT_SITES_BASE_FILE_PATH)
            utils.check_db_tables(self.connection, ["calendar"])
    def __init__(self) -> None:
        self.args = self._parse_arguments()
        self.logger = logger.set_up_script_logger(__file__, log_file=self.args.log_file, log_level=self.args.log_level)
        self.connection = utils.create_connection()
        self.latest_execution_log_path = self._get_latest_execution_log_path()
        self.latest_clean_up_log_path = self._get_latest_clean_up_log_path()

        if not self.args.dry_run:
            utils.check_db_views(self.connection, ["event_data_view_valid_events_only"])
    def __init__(self) -> None:
        self.args = self._parse_arguments()
        self.logger = logger.set_up_script_logger(
            __file__,
            log_file=self.args.log_file,
            log_level=self.args.log_level)
        self.connection = utils.create_connection()
        self.active_calendars = [
            base['url'] for base in utils.get_active_base()
        ]
        self.all_calendars_bases = utils.get_base_dict_per_url()

        if not self.args.dry_run:
            utils.check_db_tables(self.connection, ["calendar"])
            utils.check_db_views(
                self.connection,
                ["event_data_view", "event_data_view_valid_events_only"])
Exemplo n.º 5
0
 def __init__(self) -> None:
     self.connection = utils.create_connection()
     self.logger = logger.set_up_script_logger(__file__)
Exemplo n.º 6
0
import json
import os
import sqlite3
import sys
import urllib.parse as urllib
from typing import Union, Optional, List

import requests
import urllib3

from lib.constants import DATABASE_PATH, INPUT_SITES_BASE_FILE_PATH
from lib.logger import set_up_script_logger

LOGGER = set_up_script_logger(__name__)


def create_connection() -> sqlite3.Connection:
    """ Creates SQLite3 Connection to the database.

    :return: the SQLite3 Connection
    """

    try:
        connection = sqlite3.connect(DATABASE_PATH)
        return connection

    except sqlite3.Error as e:
        LOGGER.critical("Error occurred while creating a connection to the DB: {}".format(str(e)))
        sys.exit()

Exemplo n.º 7
0
 def __init__(self, parser_name: str) -> None:
     self.name = parser_name
     self.dom = None
     self.metadata = self.load_parser_file(parser_name)
     self.error_messages = []
     self.logger = logger.set_up_script_logger(__name__)