コード例 #1
0
    def __init__(self):
        """Initiate sync elements on creation."""
        self.logging = logging.getLogger("MatchTimeline")
        level = logging.INFO
        self.logging.setLevel(level)
        handler = logging.StreamHandler()
        handler.setLevel(level)
        handler.setFormatter(
            logging.Formatter("%(asctime)s [MatchTimeline] %(message)s"))
        self.logging.addHandler(handler)

        self.proxy = os.environ["PROXY_URL"]
        self.server = os.environ["SERVER"]
        self.batch_size = int(os.environ["BATCH_SIZE"])

        self.redis = RedisConnector()
        self.db = PostgresConnector(user=self.server.lower())
        self.db.set_prepare(self.prepare)

        self.stopped = False
        self.retry_after = datetime.now()
        self.url = (f"http://{self.server.lower()}.api.riotgames.com/lol/" +
                    "match/v4/timelines/by-match/%s")

        self.buffered_elements = (
            {}
        )  # Short term buffer to keep track of currently ongoing requests

        self.active_tasks = []
コード例 #2
0
ファイル: logic.py プロジェクト: GodOfOwls/Lightshield
    def __init__(self):
        """Initiate sync elements on creation."""
        self.logging = logging.getLogger("MatchHistory")
        level = logging.INFO
        self.logging.setLevel(level)
        handler = logging.StreamHandler()
        handler.setLevel(level)
        handler.setFormatter(
            logging.Formatter("%(asctime)s [MatchHistory] %(message)s"))
        self.logging.addHandler(handler)
        self.server = os.environ["SERVER"]

        self.redis = RedisConnector()
        self.db = PostgresConnector(user=self.server.lower())
        self.db.set_prepare(self.prepare)

        self.stopped = False
        self.retry_after = datetime.now()
        self.url = (
            f"http://{self.server.lower()}.api.riotgames.com/lol/" +
            "match/v4/matchlists/by-account/%s?beginIndex=%s&endIndex=%s")

        if "QUEUES" in os.environ:
            self.queues = [
                int(queue) for queue in os.environ["QUEUES"].split(",")
            ]
            self.url = self.url + "&queue=" + os.environ["QUEUES"]

        self.buffered_elements = (
            {}
        )  # Short term buffer to keep track of currently ongoing requests

        self.active_tasks = []
        self.insert_query = None
コード例 #3
0
 def __init__(self, queues):
     self.logging = logging.getLogger("Main")
     level = logging.INFO
     self.logging.setLevel(level)
     handler = logging.StreamHandler()
     handler.setLevel(level)
     handler.setFormatter(logging.Formatter("%(asctime)s %(message)s"))
     self.logging.addHandler(handler)
     self.server = os.environ["SERVER"]
     self.batchsize = int(os.environ["BATCH_SIZE"])
     self.db = PostgresConnector(user=self.server.lower())
     self.allowed_queues = queues
コード例 #4
0
 def __init__(self):
     self.logging = logging.getLogger("Main")
     level = logging.INFO
     self.logging.setLevel(level)
     handler = logging.StreamHandler()
     handler.setLevel(level)
     handler.setFormatter(logging.Formatter("%(asctime)s %(message)s"))
     self.logging.addHandler(handler)
     self.server = os.environ["SERVER"].lower()
     self.block_limit = int(os.environ["TASK_BLOCKING"])
     self.redis = RedisConnector()
     self.db = PostgresConnector(user=self.server.lower())
コード例 #5
0
    def __init__(self):
        self.logging = logging.getLogger("Main")
        level = logging.INFO
        self.logging.setLevel(level)
        handler = logging.StreamHandler()
        handler.setLevel(level)
        handler.setFormatter(logging.Formatter("%(asctime)s %(message)s"))
        self.min_matches = int(os.environ["MIN_MATCHES"])
        self.server = os.environ["SERVER"]
        self.logging.addHandler(handler)

        self.redis = RedisConnector()
        self.db = PostgresConnector(user=self.server.lower())
コード例 #6
0
    def __init__(self):
        """Initiate sync elements on creation."""
        self.logging = logging.getLogger("LeagueRankings")
        self.logging.setLevel(logging.INFO)
        handler = logging.StreamHandler()
        handler.setLevel(logging.INFO)
        handler.setFormatter(
            logging.Formatter("%(asctime)s [Subscriber] %(message)s"))
        self.logging.addHandler(handler)

        self.server = os.environ["SERVER"]
        self.db = PostgresConnector(user=self.server.lower())

        self.url = (f"http://{self.server.lower()}.api.riotgames.com/lol/" +
                    "league-exp/v4/entries/RANKED_SOLO_5x5/%s/%s?page=%s")
        self.rankmanager = RankManager()
        self.retry_after = datetime.now()