pycoze 0.1.186__py3-none-any.whl → 0.1.188__py3-none-any.whl
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.
- pycoze/automation/__init__.py +0 -0
- pycoze/automation/browser/__init__.py +0 -0
- pycoze/automation/browser/edge_driver_manager.py +72 -0
- {pycoze-0.1.186.dist-info → pycoze-0.1.188.dist-info}/METADATA +1 -1
- {pycoze-0.1.186.dist-info → pycoze-0.1.188.dist-info}/RECORD +8 -5
- {pycoze-0.1.186.dist-info → pycoze-0.1.188.dist-info}/LICENSE +0 -0
- {pycoze-0.1.186.dist-info → pycoze-0.1.188.dist-info}/WHEEL +0 -0
- {pycoze-0.1.186.dist-info → pycoze-0.1.188.dist-info}/top_level.txt +0 -0
File without changes
|
File without changes
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import os
|
2
|
+
import requests
|
3
|
+
from selenium.webdriver.edge.service import Service
|
4
|
+
from webdriver_manager.microsoft import EdgeChromiumDriverManager
|
5
|
+
|
6
|
+
|
7
|
+
# Function to check network availability
|
8
|
+
def is_network_available():
|
9
|
+
try:
|
10
|
+
# Attempt to access the download URL for Edge Chromium driver to check network connection
|
11
|
+
response = requests.get("https://msedgedriver.azureedge.net/", timeout=5)
|
12
|
+
return response.status_code == 200
|
13
|
+
except requests.ConnectionError:
|
14
|
+
return False
|
15
|
+
|
16
|
+
|
17
|
+
# Function to get the default download path for Edge Chromium driver
|
18
|
+
def get_default_driver_path():
|
19
|
+
manager = EdgeChromiumDriverManager()
|
20
|
+
return manager.install()
|
21
|
+
|
22
|
+
|
23
|
+
# Function to get the driver version from cache
|
24
|
+
def get_cached_driver_version(manager):
|
25
|
+
cache_dir = manager._cache_manager._root_dir # Get the root path of the cache directory
|
26
|
+
os_type = manager._os_system_manager.get_os_type() # Get the OS type
|
27
|
+
driver_name = manager.driver.get_name()
|
28
|
+
|
29
|
+
# List all versions in the cache directory
|
30
|
+
versions_dir = os.path.join(cache_dir, "drivers", driver_name, os_type)
|
31
|
+
if os.path.exists(versions_dir):
|
32
|
+
versions = os.listdir(versions_dir)
|
33
|
+
if versions:
|
34
|
+
# Return the latest version found in the cache
|
35
|
+
return max(versions)
|
36
|
+
return None
|
37
|
+
|
38
|
+
|
39
|
+
# Function to check if the driver has already been downloaded
|
40
|
+
def get_driver_path():
|
41
|
+
network_available = is_network_available()
|
42
|
+
print("Network status:", "Available" if network_available else "Unavailable")
|
43
|
+
manager = EdgeChromiumDriverManager()
|
44
|
+
if network_available:
|
45
|
+
return get_default_driver_path()
|
46
|
+
else:
|
47
|
+
# If no network, check the cache directory
|
48
|
+
driver_version = get_cached_driver_version(manager)
|
49
|
+
if driver_version:
|
50
|
+
driver_name = manager.driver.get_name()
|
51
|
+
os_type = manager._os_system_manager.get_os_type()
|
52
|
+
cache_dir = manager._cache_manager._root_dir
|
53
|
+
|
54
|
+
# Construct the driver path
|
55
|
+
driver_path = os.path.join(cache_dir, "drivers", driver_name, os_type, driver_version)
|
56
|
+
# Check if the driver path exists
|
57
|
+
if os.path.exists(driver_path):
|
58
|
+
return driver_path
|
59
|
+
raise Exception("Network unavailable and no downloaded driver found")
|
60
|
+
|
61
|
+
|
62
|
+
# Function to get the Edge driver service
|
63
|
+
def get_edge_driver_service():
|
64
|
+
driver_path = get_driver_path()
|
65
|
+
|
66
|
+
# Check if the driver path exists
|
67
|
+
if os.path.exists(driver_path):
|
68
|
+
return Service(driver_path)
|
69
|
+
else:
|
70
|
+
raise Exception("Network unavailable and no downloaded driver found")
|
71
|
+
|
72
|
+
|
@@ -1,6 +1,9 @@
|
|
1
1
|
pycoze/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
pycoze/ai/__init__.py,sha256=odM2lgYSnApxw4AzLV_5AyaxL5_MLfydOSB1VmLGFyA,75
|
3
3
|
pycoze/ai/vram_reserve.py,sha256=jtNsXamhwquyL9_qknZVu-8vQWaPfUdmvjLbDZaZ4vU,4262
|
4
|
+
pycoze/automation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
pycoze/automation/browser/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
+
pycoze/automation/browser/edge_driver_manager.py,sha256=j6JjIG9x2zTrBGy8DnEH1wqwNmwXe6hKZXWDwUp1GwE,2685
|
4
7
|
pycoze/bot/__init__.py,sha256=6HHMxDQVOyZM9dtSjQm9tjGnhj4h7CixD0JOvEwTi48,41
|
5
8
|
pycoze/bot/agent_chat.py,sha256=KshLVuXSnkWsp1J9xKKhoIMvAfQXg5ZyzSkPZdwcRkM,2785
|
6
9
|
pycoze/bot/bot.py,sha256=CCnBmxtmpmz7aLR_MIIiOuKR9IACo5P4uSkQXb5d0KU,3061
|
@@ -24,8 +27,8 @@ pycoze/utils/__init__.py,sha256=Gi5EnrWZGMD2JRejgV4c_VLCXyvA2wwBFI_niDF5MUE,110
|
|
24
27
|
pycoze/utils/arg.py,sha256=GtfGbMTMdaK75Fwh6MpUe1pCA5X6Ep4LFG7a72YrzjI,525
|
25
28
|
pycoze/utils/env.py,sha256=W04lhvTHhAAC6EldP6kk2xrctqtu8K6kl1vDLZDNeh8,561
|
26
29
|
pycoze/utils/text_or_file.py,sha256=gpxZVWt2DW6YiEg_MnMuwg36VNf3TX383QD_1oZNB0Y,551
|
27
|
-
pycoze-0.1.
|
28
|
-
pycoze-0.1.
|
29
|
-
pycoze-0.1.
|
30
|
-
pycoze-0.1.
|
31
|
-
pycoze-0.1.
|
30
|
+
pycoze-0.1.188.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
|
31
|
+
pycoze-0.1.188.dist-info/METADATA,sha256=S9UkCmWmVdfW0qr08Zjz3rWv14Tlz2mMnkGBfVU7SWc,726
|
32
|
+
pycoze-0.1.188.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
|
33
|
+
pycoze-0.1.188.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
|
34
|
+
pycoze-0.1.188.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|