Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit be9db4c

Browse files
committed
Move method get_settings to utils
1 parent 3605f4c commit be9db4c

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

main.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@
22

33
from playwright.sync_api import sync_playwright
44

5-
from models import Settings
6-
from utils import TwitterCrawler, VideoDownloader
7-
8-
9-
def get_settings() -> Settings:
10-
with open('settings.json', 'r', encoding='utf-8') as settings_file:
11-
settings_dict: dict[str, str] = json.load(settings_file)
12-
return Settings.parse_obj(settings_dict)
5+
from utils import TwitterCrawler, VideoDownloader, get_settings
136

147

158
def is_new_video_exists(crawler: TwitterCrawler, username: str, recent_liked: str) -> bool:

utils/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# pylint: disable=useless-import-alias
22

3+
from .get_settings import get_settings as get_settings
34
from .twitter_crawler import TwitterCrawler as TwitterCrawler
45
from .video_downloader import VideoDownloader as VideoDownloader

utils/get_settings.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import json
2+
3+
from models import Settings
4+
5+
6+
def get_settings() -> Settings:
7+
with open('settings.json', 'r', encoding='utf-8') as settings_file:
8+
settings_dict: dict[str, str] = json.load(settings_file)
9+
return Settings.parse_obj(settings_dict)

0 commit comments

Comments
 (0)