From 1c6356a64186eca878340c6922714873754d5030 Mon Sep 17 00:00:00 2001 From: Ali Moghimi Date: Sun, 29 Oct 2023 07:50:40 +0000 Subject: [PATCH] style: add typing --- scraper/engine.py | 4 ++-- utils/request_helper.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scraper/engine.py b/scraper/engine.py index 8155fbb..2a17abb 100644 --- a/scraper/engine.py +++ b/scraper/engine.py @@ -6,7 +6,7 @@ class Engine: - def __init__(self, url, max_retries, backoff_factor) -> None: + def __init__(self, url: str, max_retries: int, backoff_factor: int) -> None: self.url = url self.request = Request(max_retries=max_retries, backoff_factor=backoff_factor) @@ -28,7 +28,7 @@ def fetch(self, content: str = None) -> pd.DataFrame: logger.info(f"Parsed content from {self.url}. Extracted {len(df)} rows.") return df - def get_content(self): + def get_content(self) -> str: try: r = self.request.request("GET", self.url) r.raise_for_status() diff --git a/utils/request_helper.py b/utils/request_helper.py index 3097fb9..8fbb15e 100644 --- a/utils/request_helper.py +++ b/utils/request_helper.py @@ -6,7 +6,7 @@ class Request: - def __init__(self, max_retries, backoff_factor) -> None: + def __init__(self, max_retries: int, backoff_factor: int) -> None: self.max_retries = max_retries self.backoff_factor = backoff_factor