-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_loader.py
More file actions
77 lines (61 loc) · 2.7 KB
/
config_loader.py
File metadata and controls
77 lines (61 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import yaml
from pydantic import BaseModel, Field
from typing import List, Optional, Tuple
class APIKeys(BaseModel):
openai: Optional[str] = None
gemini: Optional[str] = None
deepseek: Optional[str] = None
groq: Optional[str] = None
telegram_bot: str
telegram_chat_id: Optional[str] = None
telegram_channel_id: Optional[str] = None
two_captcha: Optional[str] = None
cerebras: Optional[str] = None
sambanova: Optional[str] = None
class SystemPaths(BaseModel):
target_zip: str
readme_template: str
db_path: str
accounts_file: str
proxies_file: str
# НОВОЕ: папка для persistent browser profiles
profiles_dir: str = "data/profiles"
class Settings(BaseModel):
max_concurrent_browsers: int = 1
human_delay_range: Tuple[int, int] = (8, 15)
auto_update_readme_days: int = 30
# НОВОЕ: режим антидетекта
# "legacy" — старый код со stealth_async (дефолт для обратной совместимости)
# "v2" — новый StealthContext (patchright + persistent + human typing)
stealth_mode: str = "legacy"
# НОВОЕ: тип браузера для v2
# "chromium" — через patchright (РЕКОМЕНДУЕТСЯ)
# "firefox" — обычный Playwright Firefox (запасной вариант)
browser: str = "chromium"
# НОВОЕ: использовать persistent context (один профиль на аккаунт)
use_persistent_context: bool = True
# НОВОЕ: режим прокси
# "any" — работает с любыми прокси (дефолт)
# "residential_only" — отбрасывает datacenter-прокси по ASN
proxy_mode: str = "any"
# НОВОЕ: подтягивать геолокацию из IP (timezone, locale) для контекста
geo_aware_context: bool = True
# НОВОЕ: headless по умолчанию (False = видимое окно)
headless: bool = False
# ── Warmup settings (Этап 6) ──
warmup_mode: str = "minimum" # minimum | balanced
warmup_start_hour: int = 9
warmup_end_hour: int = 23
warmup_max_parallel: int = 2
warmup_keywords: List[str] = Field(
default_factory=lambda: ["tool", "utility", "cli", "automation"]
)
class Config(BaseModel):
api_keys: APIKeys
paths: SystemPaths
proxies: List[str] = []
settings: Settings
def load_config(path: str = "config.yaml") -> Config:
with open(path, 'r', encoding='utf-8') as f:
data = yaml.safe_load(f)
return Config(**data)