majorchik-api 0.0.3.2__tar.gz → 0.0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/PKG-INFO +1 -1
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/pyproject.toml +1 -1
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/src/browser_ai/base_api.py +53 -0
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/src/browser_ai/google_ai_studio_api.py +56 -1
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/src/majorchik_api.egg-info/PKG-INFO +1 -1
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/README.md +0 -0
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/setup.cfg +0 -0
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/src/browser_ai/__init__.py +0 -0
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/src/browser_ai/cli.py +0 -0
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/src/browser_ai/deepseek_api.py +0 -0
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/src/browser_ai/exceptions.py +0 -0
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/src/browser_ai/factory.py +0 -0
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/src/majorchik_api.egg-info/SOURCES.txt +0 -0
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/src/majorchik_api.egg-info/dependency_links.txt +0 -0
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/src/majorchik_api.egg-info/entry_points.txt +0 -0
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/src/majorchik_api.egg-info/requires.txt +0 -0
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/src/majorchik_api.egg-info/top_level.txt +0 -0
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/tests/test_setup_profile.py +0 -0
- {majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/tests/test_upload.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: majorchik-api
|
|
3
|
-
Version: 0.0.3.
|
|
3
|
+
Version: 0.0.3.4
|
|
4
4
|
Summary: Пакет для взаимодействия с современными нейросетями (Gemini, DeepSeek) через автоматизацию браузера
|
|
5
5
|
Author-email: GO Software <gosoftware2025@gmail.com>
|
|
6
6
|
Requires-Python: >=3.8
|
|
@@ -28,6 +28,46 @@ class BaseWebAPI(ABC):
|
|
|
28
28
|
def _start_browser(self, headless: bool):
|
|
29
29
|
self.close()
|
|
30
30
|
self.headless = headless
|
|
31
|
+
|
|
32
|
+
if getattr(self, 'setup_mode', False):
|
|
33
|
+
import subprocess, sys, shutil
|
|
34
|
+
chrome_path = None
|
|
35
|
+
if sys.platform == "win32":
|
|
36
|
+
paths = [
|
|
37
|
+
r"C:\Program Files\Google\Chrome\Application\chrome.exe",
|
|
38
|
+
r"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe",
|
|
39
|
+
os.path.expandvars(r"%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe")
|
|
40
|
+
]
|
|
41
|
+
for p in paths:
|
|
42
|
+
if os.path.exists(p):
|
|
43
|
+
chrome_path = p
|
|
44
|
+
break
|
|
45
|
+
elif sys.platform == "darwin":
|
|
46
|
+
chrome_path = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
|
47
|
+
else:
|
|
48
|
+
for name in ["google-chrome", "google-chrome-stable", "chromium-browser", "chromium"]:
|
|
49
|
+
if shutil.which(name):
|
|
50
|
+
chrome_path = name
|
|
51
|
+
break
|
|
52
|
+
|
|
53
|
+
if not chrome_path:
|
|
54
|
+
raise Exception("Не удалось найти Google Chrome в системе. Установите его для авторизации.")
|
|
55
|
+
|
|
56
|
+
import os
|
|
57
|
+
os.makedirs(self.profile_dir, exist_ok=True)
|
|
58
|
+
self.process = subprocess.Popen([
|
|
59
|
+
chrome_path,
|
|
60
|
+
f"--user-data-dir={self.profile_dir}",
|
|
61
|
+
"--no-first-run",
|
|
62
|
+
"--no-default-browser-check",
|
|
63
|
+
self.url
|
|
64
|
+
])
|
|
65
|
+
self.headless = False
|
|
66
|
+
self.browser = None
|
|
67
|
+
self.playwright = None
|
|
68
|
+
self.page = None
|
|
69
|
+
return
|
|
70
|
+
|
|
31
71
|
self.playwright = sync_playwright().start()
|
|
32
72
|
|
|
33
73
|
args =[
|
|
@@ -85,6 +125,19 @@ class BaseWebAPI(ABC):
|
|
|
85
125
|
pass
|
|
86
126
|
|
|
87
127
|
def close(self):
|
|
128
|
+
if hasattr(self, 'process') and self.process:
|
|
129
|
+
try:
|
|
130
|
+
import sys
|
|
131
|
+
if sys.platform == "win32":
|
|
132
|
+
import subprocess
|
|
133
|
+
subprocess.call(["taskkill", "/F", "/T", "/PID", str(self.process.pid)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
134
|
+
else:
|
|
135
|
+
self.process.terminate()
|
|
136
|
+
self.process.wait(timeout=3)
|
|
137
|
+
except:
|
|
138
|
+
pass
|
|
139
|
+
self.process = None
|
|
140
|
+
|
|
88
141
|
if hasattr(self, 'browser') and self.browser:
|
|
89
142
|
try: self.browser.close()
|
|
90
143
|
except: pass
|
|
@@ -22,10 +22,65 @@ class GoogleAIStudioAPI(BaseWebAPI):
|
|
|
22
22
|
headless=headless,
|
|
23
23
|
disable_images=disable_images,
|
|
24
24
|
setup_mode=setup_mode,
|
|
25
|
-
apply_stealth=False,
|
|
25
|
+
apply_stealth=False,
|
|
26
26
|
**kwargs
|
|
27
27
|
)
|
|
28
28
|
|
|
29
|
+
def _start_browser(self, headless: bool):
|
|
30
|
+
if getattr(self, 'setup_mode', False):
|
|
31
|
+
import subprocess, sys, shutil, os
|
|
32
|
+
chrome_path = None
|
|
33
|
+
if sys.platform == "win32":
|
|
34
|
+
paths = [
|
|
35
|
+
r"C:\Program Files\Google\Chrome\Application\chrome.exe",
|
|
36
|
+
r"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe",
|
|
37
|
+
os.path.expandvars(r"%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe")
|
|
38
|
+
]
|
|
39
|
+
for p in paths:
|
|
40
|
+
if os.path.exists(p):
|
|
41
|
+
chrome_path = p
|
|
42
|
+
break
|
|
43
|
+
elif sys.platform == "darwin":
|
|
44
|
+
chrome_path = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
|
45
|
+
else:
|
|
46
|
+
for name in ["google-chrome", "google-chrome-stable", "chromium-browser", "chromium"]:
|
|
47
|
+
if shutil.which(name):
|
|
48
|
+
chrome_path = name
|
|
49
|
+
break
|
|
50
|
+
|
|
51
|
+
if not chrome_path:
|
|
52
|
+
raise Exception("Не удалось найти Google Chrome в системе. Установите его для авторизации.")
|
|
53
|
+
|
|
54
|
+
os.makedirs(self.profile_dir, exist_ok=True)
|
|
55
|
+
self.process = subprocess.Popen([
|
|
56
|
+
chrome_path,
|
|
57
|
+
f"--user-data-dir={self.profile_dir}",
|
|
58
|
+
"--no-first-run",
|
|
59
|
+
"--no-default-browser-check",
|
|
60
|
+
self.url
|
|
61
|
+
])
|
|
62
|
+
self.headless = False
|
|
63
|
+
self.browser = None
|
|
64
|
+
self.playwright = None
|
|
65
|
+
self.page = None
|
|
66
|
+
else:
|
|
67
|
+
super()._start_browser(headless)
|
|
68
|
+
|
|
69
|
+
def close(self):
|
|
70
|
+
if hasattr(self, 'process') and self.process:
|
|
71
|
+
try:
|
|
72
|
+
import sys
|
|
73
|
+
if sys.platform == "win32":
|
|
74
|
+
import subprocess
|
|
75
|
+
subprocess.call(["taskkill", "/F", "/T", "/PID", str(self.process.pid)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
76
|
+
else:
|
|
77
|
+
self.process.terminate()
|
|
78
|
+
self.process.wait(timeout=3)
|
|
79
|
+
except:
|
|
80
|
+
pass
|
|
81
|
+
self.process = None
|
|
82
|
+
super().close()
|
|
83
|
+
|
|
29
84
|
def wait_for_ready(self):
|
|
30
85
|
for _ in range(30):
|
|
31
86
|
if "accounts.google.com" in self.page.url or "signin" in self.page.url.lower():
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: majorchik-api
|
|
3
|
-
Version: 0.0.3.
|
|
3
|
+
Version: 0.0.3.4
|
|
4
4
|
Summary: Пакет для взаимодействия с современными нейросетями (Gemini, DeepSeek) через автоматизацию браузера
|
|
5
5
|
Author-email: GO Software <gosoftware2025@gmail.com>
|
|
6
6
|
Requires-Python: >=3.8
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{majorchik_api-0.0.3.2 → majorchik_api-0.0.3.4}/src/majorchik_api.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|