Expose data_path in Patcher

This commit is contained in:
Ian Macalinao 2023-07-21 16:14:03 +09:00
parent 1c704a71cf
commit b175acb847
No known key found for this signature in database
GPG Key ID: 23023A87F0BE00F3
2 changed files with 7 additions and 1 deletions

View File

@ -28,6 +28,7 @@ import subprocess
import sys import sys
import tempfile import tempfile
import time import time
import typing
from weakref import finalize from weakref import finalize
import selenium.webdriver.chrome.service import selenium.webdriver.chrome.service
@ -124,6 +125,7 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
debug=False, debug=False,
no_sandbox=True, no_sandbox=True,
user_multi_procs: bool = False, user_multi_procs: bool = False,
data_path: typing.Optional[str] = None,
**kw, **kw,
): ):
""" """
@ -252,6 +254,7 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
force=patcher_force_close, force=patcher_force_close,
version_main=version_main, version_main=version_main,
user_multi_procs=user_multi_procs, user_multi_procs=user_multi_procs,
data_path=data_path,
) )
# self.patcher.auto(user_multiprocess = user_multi_num_procs) # self.patcher.auto(user_multiprocess = user_multi_num_procs)
self.patcher.auto() self.patcher.auto()

View File

@ -8,10 +8,10 @@ import os
import pathlib import pathlib
import random import random
import re import re
import shutil
import string import string
import sys import sys
import time import time
import typing
from urllib.request import urlopen from urllib.request import urlopen
from urllib.request import urlretrieve from urllib.request import urlretrieve
import zipfile import zipfile
@ -57,6 +57,7 @@ class Patcher(object):
force=False, force=False,
version_main: int = 0, version_main: int = 0,
user_multi_procs=False, user_multi_procs=False,
data_path: typing.Optional[str] = None,
): ):
""" """
Args: Args:
@ -67,6 +68,8 @@ class Patcher(object):
version_main: 0 = auto version_main: 0 = auto
specify main chrome version (rounded, ex: 82) specify main chrome version (rounded, ex: 82)
""" """
if data_path:
self.data_path = data_path
self.force = force self.force = force
self._custom_exe_path = False self._custom_exe_path = False
prefix = "undetected" prefix = "undetected"