code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def pushd(new_dir): """Context manager for changing the current working directory.""" prev_dir = os.getcwd() os.chdir(new_dir) try: yield finally: os.chdir(prev_dir)
Context manager for changing the current working directory.
pushd
python
IntelligenzaArtificiale/Free-Auto-GPT
AUTOGPT.py
https://github.com/IntelligenzaArtificiale/Free-Auto-GPT/blob/master/AUTOGPT.py
MIT
async def async_load_playwright(url: str) -> str: """Load the specified URLs using Playwright and parse using BeautifulSoup.""" from bs4 import BeautifulSoup from playwright.async_api import async_playwright try: print(">>> WARNING <<<") print( "If you are running this for t...
Load the specified URLs using Playwright and parse using BeautifulSoup.
async_load_playwright
python
IntelligenzaArtificiale/Free-Auto-GPT
AUTOGPT.py
https://github.com/IntelligenzaArtificiale/Free-Auto-GPT/blob/master/AUTOGPT.py
MIT
def _run(self, url: str, question: str) -> str: """Useful for browsing websites and scraping the text information.""" result = browse_web_page.run(url) docs = [Document(page_content=result, metadata={"source": url})] web_docs = self.text_splitter.split_documents(docs) results = [...
Useful for browsing websites and scraping the text information.
_run
python
IntelligenzaArtificiale/Free-Auto-GPT
AUTOGPT.py
https://github.com/IntelligenzaArtificiale/Free-Auto-GPT/blob/master/AUTOGPT.py
MIT
def _get_top_tasks(self, query: str, k: int) -> List[str]: """Get the top k tasks based on the query.""" results = self.vectorstore.similarity_search(query, k=k) if not results: return [] return [str(item.metadata["task"]) for item in results]
Get the top k tasks based on the query.
_get_top_tasks
python
IntelligenzaArtificiale/Free-Auto-GPT
BabyAgi/BabyAGIMod.py
https://github.com/IntelligenzaArtificiale/Free-Auto-GPT/blob/master/BabyAgi/BabyAGIMod.py
MIT
def chat(self, task, *, return_code=False, remote=False, **kwargs): """ Sends a new request to the agent in a chat. Will use the previous ones in its history. Args: task (`str`): The task to perform return_code (`bool`, *optional*, defaults to `False`): W...
Sends a new request to the agent in a chat. Will use the previous ones in its history. Args: task (`str`): The task to perform return_code (`bool`, *optional*, defaults to `False`): Whether to just return code and not evaluate it. remote (`bool`, *op...
chat
python
IntelligenzaArtificiale/Free-Auto-GPT
hfAgent/agents.py
https://github.com/IntelligenzaArtificiale/Free-Auto-GPT/blob/master/hfAgent/agents.py
MIT
def prepare_for_new_chat(self): """ Clears the history of prior calls to [`~Agent.chat`]. """ self.chat_history = None self.chat_state = {} self.cached_tools = None
Clears the history of prior calls to [`~Agent.chat`].
prepare_for_new_chat
python
IntelligenzaArtificiale/Free-Auto-GPT
hfAgent/agents.py
https://github.com/IntelligenzaArtificiale/Free-Auto-GPT/blob/master/hfAgent/agents.py
MIT
def run(self, task, *, return_code=False, remote=False, **kwargs): """ Sends a request to the agent. Args: task (`str`): The task to perform return_code (`bool`, *optional*, defaults to `False`): Whether to just return code and not evaluate it. ...
Sends a request to the agent. Args: task (`str`): The task to perform return_code (`bool`, *optional*, defaults to `False`): Whether to just return code and not evaluate it. remote (`bool`, *optional*, defaults to `False`): Whether or...
run
python
IntelligenzaArtificiale/Free-Auto-GPT
hfAgent/agents.py
https://github.com/IntelligenzaArtificiale/Free-Auto-GPT/blob/master/hfAgent/agents.py
MIT
def start_brute_force(phone_numbers, victim_email, quiet_mode, verbose): """ Stars brute force method on a list of possible phone numbers and victim email :param phone_numbers: List of possible phone numbers :param victim_email: Email of the victim :param quiet_mode: Choose quiet mode :param ver...
Stars brute force method on a list of possible phone numbers and victim email :param phone_numbers: List of possible phone numbers :param victim_email: Email of the victim :param quiet_mode: Choose quiet mode :param verbose: Verbose mode :return:
start_brute_force
python
martinvigo/email2phonenumber
email2phonenumber.py
https://github.com/martinvigo/email2phonenumber/blob/master/email2phonenumber.py
MIT
def get_masked_email_amazon(phone_numbers, victim_email, verbose): """ Uses Amazon to obtain masked email by resetting passwords using phone numbers :param phone_numbers: List of possible phone numbers :param victim_email: Email of the victim :param verbose: Verbose mode :return: """ glo...
Uses Amazon to obtain masked email by resetting passwords using phone numbers :param phone_numbers: List of possible phone numbers :param victim_email: Email of the victim :param verbose: Verbose mode :return:
get_masked_email_amazon
python
martinvigo/email2phonenumber
email2phonenumber.py
https://github.com/martinvigo/email2phonenumber/blob/master/email2phonenumber.py
MIT
def get_masked_email_twitter(phone_numbers, victim_email, verbose): """ Uses Amazon to obtain masked email by resetting passwords using phone numbers :param phone_numbers: List of possible phone numbers :param victim_email: Victim email :param verbose: Verbose mode :return: """ global us...
Uses Amazon to obtain masked email by resetting passwords using phone numbers :param phone_numbers: List of possible phone numbers :param victim_email: Victim email :param verbose: Verbose mode :return:
get_masked_email_twitter
python
martinvigo/email2phonenumber
email2phonenumber.py
https://github.com/martinvigo/email2phonenumber/blob/master/email2phonenumber.py
MIT
def start_scrapping(email, quiet_mode): """ Starts scrapping :param email: Email to search for :param quiet_mode: Quiet mode selection :return: """ logger.info("Starting scraping online services...") if quiet_mode: scrape_paypal(email) else: scrape_ebay(email) ...
Starts scrapping :param email: Email to search for :param quiet_mode: Quiet mode selection :return:
start_scrapping
python
martinvigo/email2phonenumber
email2phonenumber.py
https://github.com/martinvigo/email2phonenumber/blob/master/email2phonenumber.py
MIT
def scrape_last_pass(email): """ Scrape last pass service :param email: Email to scrape :return: """ global userAgents global proxyList logger.info("Scraping Lastpass...") user_agent = random.choice(userAgents) proxy = random.choice(proxyList) if proxyList else None session =...
Scrape last pass service :param email: Email to scrape :return:
scrape_last_pass
python
martinvigo/email2phonenumber
email2phonenumber.py
https://github.com/martinvigo/email2phonenumber/blob/master/email2phonenumber.py
MIT
def scrape_ebay(email): """ Scrapes ebay :param email: Email to use to scrape ebay :return: """ global userAgents global proxyList logger.info("Scraping Ebay...") user_agent = random.choice(userAgents) proxy = random.choice(proxyList) if proxyList else None session = requests...
Scrapes ebay :param email: Email to use to scrape ebay :return:
scrape_ebay
python
martinvigo/email2phonenumber
email2phonenumber.py
https://github.com/martinvigo/email2phonenumber/blob/master/email2phonenumber.py
MIT
def scrape_paypal(email): """ Scrapes paypal using email :param email: Email to scrape :return: """ global userAgents global proxyList logger.info("Scraping Paypal...") user_agent = random.choice(userAgents) proxy = random.choice(proxyList) if proxyList else None session = re...
Scrapes paypal using email :param email: Email to scrape :return:
scrape_paypal
python
martinvigo/email2phonenumber
email2phonenumber.py
https://github.com/martinvigo/email2phonenumber/blob/master/email2phonenumber.py
MIT
def get_possible_phone_numbers(masked_phone): """ Returns all possible valid phone numbers according to NANPA based on a partial phone number :param masked_phone: Masked phone :return: """ global poolingCache possible_phone_numbers = [] nanpa_file_url = "https://www.nationalnanpa.com/nan...
Returns all possible valid phone numbers according to NANPA based on a partial phone number :param masked_phone: Masked phone :return:
get_possible_phone_numbers
python
martinvigo/email2phonenumber
email2phonenumber.py
https://github.com/martinvigo/email2phonenumber/blob/master/email2phonenumber.py
MIT
def cache_valid_block_numbers(state, area_code): """ Cache the valid block numbers for state and area code :param state: State :param area_code: Area code :return: """ global userAgents global proxyList global poolingCache proxy = random.choice(proxyList) if proxyList else None ...
Cache the valid block numbers for state and area code :param state: State :param area_code: Area code :return:
cache_valid_block_numbers
python
martinvigo/email2phonenumber
email2phonenumber.py
https://github.com/martinvigo/email2phonenumber/blob/master/email2phonenumber.py
MIT
async def example_with_context_manager(): """ Example using the context manager approach to handle Cloudflare captcha. This waits for the captcha to be processed before continuing. """ browser = Chrome() await browser.start() page = await browser.get_page() print('Using context manager...
Example using the context manager approach to handle Cloudflare captcha. This waits for the captcha to be processed before continuing.
example_with_context_manager
python
autoscrape-labs/pydoll
examples/cloudflare_bypass.py
https://github.com/autoscrape-labs/pydoll/blob/master/examples/cloudflare_bypass.py
MIT
async def example_with_enable_disable(): """ Example using the enable/disable approach to handle Cloudflare captcha. This enables the auto-solving and continues execution immediately. The captcha will be solved in the background when it appears. """ browser = Chrome() await browser.start() ...
Example using the enable/disable approach to handle Cloudflare captcha. This enables the auto-solving and continues execution immediately. The captcha will be solved in the background when it appears.
example_with_enable_disable
python
autoscrape-labs/pydoll
examples/cloudflare_bypass.py
https://github.com/autoscrape-labs/pydoll/blob/master/examples/cloudflare_bypass.py
MIT
async def get_browser_ws_address(port: int) -> str: """ Fetches the WebSocket address for the browser instance. Returns: str: The WebSocket address for the browser. Raises: NetworkError: If the address cannot be fetched due to network errors or missing data. Invalid...
Fetches the WebSocket address for the browser instance. Returns: str: The WebSocket address for the browser. Raises: NetworkError: If the address cannot be fetched due to network errors or missing data. InvalidResponse: If the response is not valid JSON.
get_browser_ws_address
python
autoscrape-labs/pydoll
pydoll/utils.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/utils.py
MIT
def validate_browser_paths(paths: list[str]) -> str: """ Validates potential browser executable paths and returns the first valid one. Checks a list of possible browser binary locations to find an existing, executable browser. This is used by browser-specific subclasses to locate the browser execut...
Validates potential browser executable paths and returns the first valid one. Checks a list of possible browser binary locations to find an existing, executable browser. This is used by browser-specific subclasses to locate the browser executable when no explicit binary path is provided. Args: ...
validate_browser_paths
python
autoscrape-labs/pydoll
pydoll/utils.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/utils.py
MIT
def __init__(self): """ Initializes the Options instance. Sets up an empty list for command-line arguments and a string for the binary location of the browser. """ self._arguments = [] self._binary_location = ''
Initializes the Options instance. Sets up an empty list for command-line arguments and a string for the binary location of the browser.
__init__
python
autoscrape-labs/pydoll
pydoll/browser/options.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/options.py
MIT
def add_argument(self, argument: str): """ Adds a command-line argument to the options. Args: argument (str): The command-line argument to be added. Raises: ArgumentAlreadyExistsInOptions: If the argument is already in the list of arguments. """ ...
Adds a command-line argument to the options. Args: argument (str): The command-line argument to be added. Raises: ArgumentAlreadyExistsInOptions: If the argument is already in the list of arguments.
add_argument
python
autoscrape-labs/pydoll
pydoll/browser/options.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/options.py
MIT
def __init__( self, browser: 'Browser', connection_port: int, target_id: str, browser_context_id: Optional[str] = None, ): """ Initialize tab controller for existing browser tab. Args: browser: Browser instance that created this tab. ...
Initialize tab controller for existing browser tab. Args: browser: Browser instance that created this tab. connection_port: CDP WebSocket port. target_id: CDP target identifier for this tab. browser_context_id: Optional browser context ID.
__init__
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def current_url(self) -> str: """Get current page URL (reflects redirects and client-side navigation).""" response: EvaluateResponse = await self._execute_command( RuntimeCommands.evaluate('window.location.href') ) return response['result']['result']['value']
Get current page URL (reflects redirects and client-side navigation).
current_url
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def page_source(self) -> str: """Get complete HTML source of current page (live DOM state).""" response: EvaluateResponse = await self._execute_command( RuntimeCommands.evaluate('document.documentElement.outerHTML') ) return response['result']['result']['value']
Get complete HTML source of current page (live DOM state).
page_source
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def enable_page_events(self): """Enable CDP Page domain events (load, navigation, dialogs, etc.).""" response = await self._execute_command(PageCommands.enable()) self._page_events_enabled = True return response
Enable CDP Page domain events (load, navigation, dialogs, etc.).
enable_page_events
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def enable_network_events(self): """Enable CDP Network domain events (requests, responses, etc.).""" response = await self._execute_command(NetworkCommands.enable()) self._network_events_enabled = True return response
Enable CDP Network domain events (requests, responses, etc.).
enable_network_events
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def enable_fetch_events( self, handle_auth: bool = False, resource_type: Optional[ResourceType] = None, request_stage: Optional[RequestStage] = None, ): """ Enable CDP Fetch domain for request interception. Args: handle_auth: Intercept authe...
Enable CDP Fetch domain for request interception. Args: handle_auth: Intercept authentication challenges. resource_type: Filter by resource type (all if None). request_stage: When to intercept (Request/Response). Note: Intercepted requests must ...
enable_fetch_events
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def enable_dom_events(self): """Enable CDP DOM domain events (document structure changes).""" response = await self._execute_command(DomCommands.enable()) self._dom_events_enabled = True return response
Enable CDP DOM domain events (document structure changes).
enable_dom_events
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def enable_intercept_file_chooser_dialog(self): """ Enable file chooser dialog interception for automated uploads. Note: Use expect_file_chooser context manager for convenience. """ response = await self._execute_command(PageCommands.set_intercept_file_chooser_...
Enable file chooser dialog interception for automated uploads. Note: Use expect_file_chooser context manager for convenience.
enable_intercept_file_chooser_dialog
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def enable_auto_solve_cloudflare_captcha( self, custom_selector: Optional[tuple[By, str]] = None, time_before_click: int = 2, time_to_wait_captcha: int = 5, ): """ Enable automatic Cloudflare Turnstile captcha bypass. Args: custom_selector: ...
Enable automatic Cloudflare Turnstile captcha bypass. Args: custom_selector: Custom captcha selector (default: cf-turnstile class). time_before_click: Delay before clicking captcha (default 2s). time_to_wait_captcha: Timeout for captcha detection (default 5s). ...
enable_auto_solve_cloudflare_captcha
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def disable_fetch_events(self): """Disable CDP Fetch domain and release paused requests.""" response = await self._execute_command(FetchCommands.disable()) self._fetch_events_enabled = False return response
Disable CDP Fetch domain and release paused requests.
disable_fetch_events
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def disable_auto_solve_cloudflare_captcha(self): """Disable automatic Cloudflare Turnstile captcha bypass.""" await self._connection_handler.remove_callback(self._cloudflare_captcha_callback_id) self._cloudflare_captcha_callback_id = None
Disable automatic Cloudflare Turnstile captcha bypass.
disable_auto_solve_cloudflare_captcha
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def close(self): """ Close this browser tab. Note: Tab instance becomes invalid after calling this method. """ return await self._execute_command(PageCommands.close())
Close this browser tab. Note: Tab instance becomes invalid after calling this method.
close
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def get_frame(self, frame: WebElement) -> IFrame: """ Get Tab object for interacting with iframe content. Args: frame: Tab representing the iframe (<iframe> tag). Returns: Tab instance configured for iframe interaction. Raises: NotAnIF...
Get Tab object for interacting with iframe content. Args: frame: Tab representing the iframe (<iframe> tag). Returns: Tab instance configured for iframe interaction. Raises: NotAnIFrame: If element is not an iframe. InvalidIFrame: If if...
get_frame
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def get_cookies(self) -> list[Cookie]: """Get all cookies accessible from current page.""" response: GetCookiesResponse = await self._execute_command( StorageCommands.get_cookies(self._browser_context_id) ) return response['result']['cookies']
Get all cookies accessible from current page.
get_cookies
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def set_cookies(self, cookies: list[CookieParam]): """ Set multiple cookies for current page. Args: cookies: Cookie parameters (name/value required, others optional). Note: Defaults to current page's domain if not specified. """ return awai...
Set multiple cookies for current page. Args: cookies: Cookie parameters (name/value required, others optional). Note: Defaults to current page's domain if not specified.
set_cookies
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def delete_all_cookies(self): """Delete all cookies from current browser context.""" return await self._execute_command(StorageCommands.clear_cookies(self._browser_context_id))
Delete all cookies from current browser context.
delete_all_cookies
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def go_to(self, url: str, timeout: int = 300): """ Navigate to URL and wait for loading to complete. Refreshes if URL matches current page. Args: url: Target URL to navigate to. timeout: Maximum seconds to wait for page load (default 300). Raises:...
Navigate to URL and wait for loading to complete. Refreshes if URL matches current page. Args: url: Target URL to navigate to. timeout: Maximum seconds to wait for page load (default 300). Raises: PageLoadTimeout: If page doesn't finish loading wit...
go_to
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def refresh( self, ignore_cache: bool = False, script_to_evaluate_on_load: Optional[str] = None, ): """ Reload current page and wait for completion. Args: ignore_cache: Bypass browser cache if True. script_to_evaluate_on_load: JavaScript...
Reload current page and wait for completion. Args: ignore_cache: Bypass browser cache if True. script_to_evaluate_on_load: JavaScript to execute after load. Raises: PageLoadTimeout: If page doesn't finish loading within timeout.
refresh
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def take_screenshot( self, path: Optional[str] = None, quality: int = 100, as_base64: bool = False, ) -> Optional[str]: """ Capture screenshot of current page. Args: path: File path for screenshot (extension determines format). q...
Capture screenshot of current page. Args: path: File path for screenshot (extension determines format). quality: Image quality 0-100 (default 100). as_base64: Return as base64 string instead of saving file. Returns: Base64 screenshot data if as_...
take_screenshot
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def print_to_pdf( # noqa: PLR0913, PLR0917 self, path: str, landscape: bool = False, display_header_footer: bool = False, print_background: bool = True, scale: float = 1.0, as_base64: bool = False, ) -> Optional[str]: """ Generate PDF of...
Generate PDF of current page. Args: path: File path for PDF output. landscape: Use landscape orientation. display_header_footer: Include header/footer. print_background: Include background graphics. scale: Scale factor (0.1-2.0). ...
print_to_pdf
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def has_dialog(self) -> bool: """ Check if JavaScript dialog is currently displayed. Note: Page events must be enabled to detect dialogs. """ if self._connection_handler.dialog: return True return False
Check if JavaScript dialog is currently displayed. Note: Page events must be enabled to detect dialogs.
has_dialog
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def get_dialog_message(self) -> str: """ Get message text from current JavaScript dialog. Raises: NoDialogPresent: If no dialog is currently displayed. """ if not await self.has_dialog(): raise NoDialogPresent() return self._connection_handl...
Get message text from current JavaScript dialog. Raises: NoDialogPresent: If no dialog is currently displayed.
get_dialog_message
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def handle_dialog(self, accept: bool, prompt_text: Optional[str] = None): """ Respond to JavaScript dialog. Args: accept: Accept/confirm dialog if True, dismiss/cancel if False. prompt_text: Text for prompt dialogs (ignored for alert/confirm). Raises: ...
Respond to JavaScript dialog. Args: accept: Accept/confirm dialog if True, dismiss/cancel if False. prompt_text: Text for prompt dialogs (ignored for alert/confirm). Raises: NoDialogPresent: If no dialog is currently displayed. Note: Pa...
handle_dialog
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def execute_script(self, script: str, element: Optional[WebElement] = None): """ Execute JavaScript in page context. Args: script: JavaScript code to execute. element: Element context (use 'argument' in script to reference). Examples: await pag...
Execute JavaScript in page context. Args: script: JavaScript code to execute. element: Element context (use 'argument' in script to reference). Examples: await page.execute_script('argument.click()', element) await page.execute_script('argument....
execute_script
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def expect_file_chooser( self, files: Union[str, Path, list[Union[str, Path]]] ) -> AsyncGenerator[None, None]: """ Context manager for automatic file upload handling. Args: files: File path(s) for upload. """ async def event_handler(event): ...
Context manager for automatic file upload handling. Args: files: File path(s) for upload.
expect_file_chooser
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def expect_and_bypass_cloudflare_captcha( self, custom_selector: Optional[tuple[By, str]] = None, time_before_click: int = 2, time_to_wait_captcha: int = 5, ) -> AsyncGenerator[None, None]: """ Context manager for automatic Cloudflare captcha bypass. Ar...
Context manager for automatic Cloudflare captcha bypass. Args: custom_selector: Custom captcha selector (default: cf-turnstile class). time_before_click: Delay before clicking (default 2s). time_to_wait_captcha: Timeout for captcha detection (default 5s).
expect_and_bypass_cloudflare_captcha
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def on(self, event_name: str, callback: Callable[[dict], Any], temporary: bool = False): """ Register CDP event listener. Callback runs in background task to prevent blocking. Args: event_name: CDP event name (e.g., 'Page.loadEventFired'). callback: Functi...
Register CDP event listener. Callback runs in background task to prevent blocking. Args: event_name: CDP event name (e.g., 'Page.loadEventFired'). callback: Function called on event (sync or async). temporary: Remove after first invocation. Returns...
on
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def _refresh_if_url_not_changed(self, url: str) -> bool: """Refresh page if URL hasn't changed.""" current_url = await self.current_url if current_url == url: await self.refresh() return True return False
Refresh page if URL hasn't changed.
_refresh_if_url_not_changed
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def _wait_page_load(self, timeout: int = 300): """ Wait for page to finish loading. Raises: asyncio.TimeoutError: If page doesn't load within timeout. """ start_time = asyncio.get_event_loop().time() while True: response: EvaluateResponse = ...
Wait for page to finish loading. Raises: asyncio.TimeoutError: If page doesn't load within timeout.
_wait_page_load
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
async def _bypass_cloudflare( self, event: dict, custom_selector: Optional[tuple[By, str]] = None, time_before_click: int = 2, time_to_wait_captcha: int = 5, ): """Attempt to bypass Cloudflare Turnstile captcha when detected.""" try: selector = cus...
Attempt to bypass Cloudflare Turnstile captcha when detected.
_bypass_cloudflare
python
autoscrape-labs/pydoll
pydoll/browser/tab.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/tab.py
MIT
def __init__( self, options_manager: BrowserOptionsManager, connection_port: Optional[int] = None, ): """ Initialize browser instance with configuration. Args: options_manager: Manages browser options initialization and defaults. Must impl...
Initialize browser instance with configuration. Args: options_manager: Manages browser options initialization and defaults. Must implement initialize_options() and add_default_arguments(). connection_port: CDP WebSocket port. Random port (9223-9322) if None. ...
__init__
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def __aexit__(self, exc_type, exc_val, exc_tb): """Async context manager exit with cleanup.""" if await self._is_browser_running(timeout=2): await self.stop() await self._connection_handler.close()
Async context manager exit with cleanup.
__aexit__
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def start(self, headless: bool = False) -> Tab: """ Start browser process and establish CDP connection. Args: headless: Run without UI. Returns: Initial tab for interaction. Raises: FailedToStartBrowser: If the browser fails to start o...
Start browser process and establish CDP connection. Args: headless: Run without UI. Returns: Initial tab for interaction. Raises: FailedToStartBrowser: If the browser fails to start or connect.
start
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def stop(self): """ Stop browser process and cleanup resources. Sends Browser.close command, terminates process, removes temp directories, and closes WebSocket connections. Raises: BrowserNotRunning: If the browser is not currently running. """ ...
Stop browser process and cleanup resources. Sends Browser.close command, terminates process, removes temp directories, and closes WebSocket connections. Raises: BrowserNotRunning: If the browser is not currently running.
stop
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def create_browser_context( self, proxy_server: Optional[str] = None, proxy_bypass_list: Optional[str] = None ) -> str: """ Create isolated browser context (like incognito). Browser contexts provide isolated storage and don't share session data. Multiple contexts can e...
Create isolated browser context (like incognito). Browser contexts provide isolated storage and don't share session data. Multiple contexts can exist simultaneously. Args: proxy_server: Optional proxy for this context only (scheme://host:port). proxy_bypass_lis...
create_browser_context
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def delete_browser_context(self, browser_context_id: str): """ Delete browser context and all associated tabs/resources. Removes all storage (cookies, localStorage, etc.) and closes all tabs. The default browser context cannot be deleted. Note: Closes all asso...
Delete browser context and all associated tabs/resources. Removes all storage (cookies, localStorage, etc.) and closes all tabs. The default browser context cannot be deleted. Note: Closes all associated tabs immediately.
delete_browser_context
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def get_browser_contexts(self) -> list[str]: """Get all browser context IDs including the default context.""" response: GetBrowserContextsResponse = await self._execute_command( TargetCommands.get_browser_contexts() ) return response['result']['browserContextIds']
Get all browser context IDs including the default context.
get_browser_contexts
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def new_tab(self, url: str = '', browser_context_id: Optional[str] = None) -> Tab: """ Create new tab for page interaction. Args: url: Initial URL (about:blank if empty). browser_context_id: Context to create tab in (default if None). Returns: ...
Create new tab for page interaction. Args: url: Initial URL (about:blank if empty). browser_context_id: Context to create tab in (default if None). Returns: Tab instance for page navigation and element interaction.
new_tab
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def get_targets(self) -> list[TargetInfo]: """ Get all active targets/pages in browser. Targets include pages, service workers, shared workers, and browser process. Useful for debugging and managing multiple tabs. """ response: GetTargetsResponse = await self._exec...
Get all active targets/pages in browser. Targets include pages, service workers, shared workers, and browser process. Useful for debugging and managing multiple tabs.
get_targets
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def set_download_path(self, path: str, browser_context_id: Optional[str] = None): """Set download directory path (convenience method for set_download_behavior).""" return await self._execute_command( BrowserCommands.set_download_behavior(DownloadBehavior.ALLOW, path, browser_context_id...
Set download directory path (convenience method for set_download_behavior).
set_download_path
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def set_download_behavior( self, behavior: DownloadBehavior, download_path: Optional[str] = None, browser_context_id: Optional[str] = None, events_enabled: bool = False, ): """ Configure download handling. Args: behavior: ALLOW (save...
Configure download handling. Args: behavior: ALLOW (save to path), DENY (cancel), or DEFAULT. download_path: Required if behavior is ALLOW. browser_context_id: Context to apply to (default if None). events_enabled: Generate download events for progress t...
set_download_behavior
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def delete_all_cookies(self, browser_context_id: Optional[str] = None): """Delete all cookies (session, persistent, third-party) from browser or context.""" return await self._execute_command(StorageCommands.clear_cookies(browser_context_id))
Delete all cookies (session, persistent, third-party) from browser or context.
delete_all_cookies
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def set_cookies( self, cookies: list[CookieParam], browser_context_id: Optional[str] = None ): """Set multiple cookies in browser or context.""" return await self._execute_command(StorageCommands.set_cookies(cookies, browser_context_id))
Set multiple cookies in browser or context.
set_cookies
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def get_cookies(self, browser_context_id: Optional[str] = None) -> list[Cookie]: """Get all cookies from browser or context.""" response: GetCookiesResponse = await self._execute_command( StorageCommands.get_cookies(browser_context_id) ) return response['result']['cooki...
Get all cookies from browser or context.
get_cookies
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def get_version(self) -> GetVersionResultDict: """Get browser version and CDP protocol information.""" response: GetVersionResponse = await self._execute_command(BrowserCommands.get_version()) return response['result']
Get browser version and CDP protocol information.
get_version
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def get_window_id_for_target(self, target_id: str) -> int: """Get window ID for target (used for window manipulation via CDP).""" response: GetWindowForTargetResponse = await self._execute_command( BrowserCommands.get_window_for_target(target_id) ) return response['resu...
Get window ID for target (used for window manipulation via CDP).
get_window_id_for_target
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def get_window_id_for_tab(self, tab: Tab) -> int: """Get window ID for tab (convenience method).""" return await self.get_window_id_for_target(tab._target_id)
Get window ID for tab (convenience method).
get_window_id_for_tab
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def get_window_id(self) -> int: """ Get window ID for any valid tab. Raises: NoValidTabFound: If no valid attached tab can be found. """ targets = await self.get_targets() valid_tab_id = await self._get_valid_tab_id(targets) return await self.ge...
Get window ID for any valid tab. Raises: NoValidTabFound: If no valid attached tab can be found.
get_window_id
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def set_window_maximized(self): """Maximize browser window (affects all tabs in window).""" window_id = await self.get_window_id() return await self._execute_command(BrowserCommands.set_window_maximized(window_id))
Maximize browser window (affects all tabs in window).
set_window_maximized
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def set_window_minimized(self): """Minimize browser window to taskbar/dock.""" window_id = await self.get_window_id() return await self._execute_command(BrowserCommands.set_window_minimized(window_id))
Minimize browser window to taskbar/dock.
set_window_minimized
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def set_window_bounds(self, bounds: WindowBoundsDict): """ Set window position and/or size. Args: bounds: Properties to modify (left, top, width, height, windowState). Only specified properties are changed. """ window_id = await self.get_window_...
Set window position and/or size. Args: bounds: Properties to modify (left, top, width, height, windowState). Only specified properties are changed.
set_window_bounds
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def grant_permissions( self, permissions: list[PermissionType], origin: Optional[str] = None, browser_context_id: Optional[str] = None, ): """ Grant browser permissions (geolocation, notifications, camera, etc.). Bypasses normal permission prompts for a...
Grant browser permissions (geolocation, notifications, camera, etc.). Bypasses normal permission prompts for automated testing. Args: permissions: Permissions to grant. origin: Origin to grant to (all origins if None). browser_context_id: Context to apply t...
grant_permissions
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def reset_permissions(self, browser_context_id: Optional[str] = None): """Reset all permissions to defaults and restore prompting behavior.""" return await self._execute_command(BrowserCommands.reset_permissions(browser_context_id))
Reset all permissions to defaults and restore prompting behavior.
reset_permissions
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def on( self, event_name: str, callback: Callable[[Any], Any], temporary: bool = False ) -> int: """ Register CDP event listener at browser level. Callback runs in background task to prevent blocking. Affects all pages/targets. Args: event_name: CDP event ...
Register CDP event listener at browser level. Callback runs in background task to prevent blocking. Affects all pages/targets. Args: event_name: CDP event name (e.g., "Network.responseReceived"). callback: Function called on event (sync or async). temporary...
on
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def enable_fetch_events( self, handle_auth_requests: bool = False, resource_type: Optional[ResourceType] = None, ): """ Enable network request interception via Fetch domain. Allows monitoring, modifying, or blocking requests before they're sent. All mat...
Enable network request interception via Fetch domain. Allows monitoring, modifying, or blocking requests before they're sent. All matching requests are paused until explicitly continued. Args: handle_auth_requests: Intercept authentication challenges. resource_...
enable_fetch_events
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def disable_fetch_events(self): """Disable request interception and release any paused requests.""" return await self._connection_handler.execute_command(FetchCommands.disable())
Disable request interception and release any paused requests.
disable_fetch_events
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def _continue_request_callback(self, event: RequestPausedEvent): """Internal callback to continue paused requests.""" request_id = event['params']['requestId'] return await self.continue_request(request_id)
Internal callback to continue paused requests.
_continue_request_callback
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def _verify_browser_running(self): """ Verify browser started successfully. Raises: FailedToStartBrowser: If the browser failed to start. """ if not await self._is_browser_running(): raise FailedToStartBrowser()
Verify browser started successfully. Raises: FailedToStartBrowser: If the browser failed to start.
_verify_browser_running
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def _configure_proxy( self, private_proxy: bool, proxy_credentials: tuple[Optional[str], Optional[str]] ): """Setup proxy authentication handling if needed.""" if private_proxy: await self.enable_fetch_events(handle_auth_requests=True) await self.on( ...
Setup proxy authentication handling if needed.
_configure_proxy
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def _get_valid_tab_id(targets: list[TargetInfo]) -> str: """ Find valid attached tab ID. Raises: NoValidTabFound: If no valid attached tab is found. """ valid_tab = next( ( tab for tab in targets if ta...
Find valid attached tab ID. Raises: NoValidTabFound: If no valid attached tab is found.
_get_valid_tab_id
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def _is_browser_running(self, timeout: int = 10) -> bool: """Check if browser process is running and CDP endpoint is responsive.""" for _ in range(timeout): if await self._connection_handler.ping(): return True await asyncio.sleep(1) return False
Check if browser process is running and CDP endpoint is responsive.
_is_browser_running
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
async def _execute_command(self, command: Command[T], timeout: int = 10) -> T: """Execute CDP command and return result (core method for browser communication).""" return await self._connection_handler.execute_command(command, timeout=timeout)
Execute CDP command and return result (core method for browser communication).
_execute_command
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
def _setup_user_dir(self): """Setup temporary user data directory if not specified in options.""" if '--user-data-dir' not in [arg.split('=')[0] for arg in self.options.arguments]: # For all browsers, use a temporary directory temp_dir = self._temp_directory_manager.create_temp_d...
Setup temporary user data directory if not specified in options.
_setup_user_dir
python
autoscrape-labs/pydoll
pydoll/browser/chromium/base.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/base.py
MIT
def __init__( self, options: Optional[ChromiumOptions] = None, connection_port: Optional[int] = None, ): """ Initialize Chrome browser instance. Args: options: Chrome configuration options (default if None). connection_port: CDP WebSocket port...
Initialize Chrome browser instance. Args: options: Chrome configuration options (default if None). connection_port: CDP WebSocket port (random if None).
__init__
python
autoscrape-labs/pydoll
pydoll/browser/chromium/chrome.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/chrome.py
MIT
def _get_default_binary_location(): """ Get default Chrome executable path based on OS. Returns: Path to Chrome executable. Raises: UnsupportedOS: If OS is not supported. ValueError: If executable not found at default location. """ os...
Get default Chrome executable path based on OS. Returns: Path to Chrome executable. Raises: UnsupportedOS: If OS is not supported. ValueError: If executable not found at default location.
_get_default_binary_location
python
autoscrape-labs/pydoll
pydoll/browser/chromium/chrome.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/chrome.py
MIT
def __init__( self, options: Optional[Options] = None, connection_port: Optional[int] = None, ): """ Initialize Edge browser instance. Args: options: Edge configuration options (default if None). connection_port: CDP WebSocket port (random if ...
Initialize Edge browser instance. Args: options: Edge configuration options (default if None). connection_port: CDP WebSocket port (random if None).
__init__
python
autoscrape-labs/pydoll
pydoll/browser/chromium/edge.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/edge.py
MIT
def _get_default_binary_location(): """ Get default Edge executable path based on OS. Returns: Path to Edge executable. Raises: UnsupportedOS: If OS is not supported. ValueError: If executable not found at default location. """ os_nam...
Get default Edge executable path based on OS. Returns: Path to Edge executable. Raises: UnsupportedOS: If OS is not supported. ValueError: If executable not found at default location.
_get_default_binary_location
python
autoscrape-labs/pydoll
pydoll/browser/chromium/edge.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/chromium/edge.py
MIT
def initialize_options( self, ) -> ChromiumOptions: """ Initialize and validate browser options. Creates ChromiumOptions if none provided, validates existing options, and applies default CDP arguments. Returns: Properly configured ChromiumOptions instanc...
Initialize and validate browser options. Creates ChromiumOptions if none provided, validates existing options, and applies default CDP arguments. Returns: Properly configured ChromiumOptions instance. Raises: InvalidOptionsObject: If provided options i...
initialize_options
python
autoscrape-labs/pydoll
pydoll/browser/managers/browser_options_manager.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/managers/browser_options_manager.py
MIT
def __init__( self, process_creator: Optional[Callable[[list[str]], subprocess.Popen]] = None, ): """ Initialize browser process manager. Args: process_creator: Custom function to create browser processes. Must accept command list and return subpr...
Initialize browser process manager. Args: process_creator: Custom function to create browser processes. Must accept command list and return subprocess.Popen object. Uses default subprocess implementation if None.
__init__
python
autoscrape-labs/pydoll
pydoll/browser/managers/browser_process_manager.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/managers/browser_process_manager.py
MIT
def start_browser_process( self, binary_location: str, port: int, arguments: list[str], ) -> subprocess.Popen: """ Launch browser process with CDP debugging enabled. Args: binary_location: Path to browser executable. port: TCP port for...
Launch browser process with CDP debugging enabled. Args: binary_location: Path to browser executable. port: TCP port for CDP WebSocket connections. arguments: Additional command-line arguments. Returns: Started browser process instance. ...
start_browser_process
python
autoscrape-labs/pydoll
pydoll/browser/managers/browser_process_manager.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/managers/browser_process_manager.py
MIT
def stop_process(self): """ Terminate browser process with graceful shutdown. Attempts SIGTERM first, then SIGKILL after 15-second timeout. Safe to call even if no process is running. """ if self._process: self._process.terminate() try: ...
Terminate browser process with graceful shutdown. Attempts SIGTERM first, then SIGKILL after 15-second timeout. Safe to call even if no process is running.
stop_process
python
autoscrape-labs/pydoll
pydoll/browser/managers/browser_process_manager.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/managers/browser_process_manager.py
MIT
def get_proxy_credentials(self) -> tuple[bool, tuple[Optional[str], Optional[str]]]: """ Extract and secure proxy authentication credentials. Searches for proxy settings, extracts embedded credentials, and sanitizes options to remove credential exposure. Returns: Tu...
Extract and secure proxy authentication credentials. Searches for proxy settings, extracts embedded credentials, and sanitizes options to remove credential exposure. Returns: Tuple of (has_private_proxy, (username, password)).
get_proxy_credentials
python
autoscrape-labs/pydoll
pydoll/browser/managers/proxy_manager.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/managers/proxy_manager.py
MIT
def _find_proxy_argument(self) -> Optional[tuple[int, str]]: """ Find proxy server configuration in browser options. Returns: Tuple of (index, proxy_url) if found, None otherwise. """ for index, arg in enumerate(self.options.arguments): if arg.startswith(...
Find proxy server configuration in browser options. Returns: Tuple of (index, proxy_url) if found, None otherwise.
_find_proxy_argument
python
autoscrape-labs/pydoll
pydoll/browser/managers/proxy_manager.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/managers/proxy_manager.py
MIT
def _parse_proxy(proxy_value: str) -> tuple[bool, Optional[str], Optional[str], str]: """ Parse proxy URL to extract authentication credentials. Args: proxy_value: Proxy URL potentially containing username:password@server:port. Returns: Tuple of (has_credentials...
Parse proxy URL to extract authentication credentials. Args: proxy_value: Proxy URL potentially containing username:password@server:port. Returns: Tuple of (has_credentials, username, password, clean_proxy_url).
_parse_proxy
python
autoscrape-labs/pydoll
pydoll/browser/managers/proxy_manager.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/managers/proxy_manager.py
MIT
def __init__(self, temp_dir_factory: Callable[[], TemporaryDirectory] = TemporaryDirectory): """ Initialize temporary directory manager. Args: temp_dir_factory: Function to create temporary directories. Must return TemporaryDirectory-compatible object. """ ...
Initialize temporary directory manager. Args: temp_dir_factory: Function to create temporary directories. Must return TemporaryDirectory-compatible object.
__init__
python
autoscrape-labs/pydoll
pydoll/browser/managers/temp_dir_manager.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/managers/temp_dir_manager.py
MIT
def create_temp_dir(self) -> TemporaryDirectory: """ Create and track new temporary directory for browser use. Returns: TemporaryDirectory object for browser --user-data-dir argument. """ temp_dir = self._temp_dir_factory() self._temp_dirs.append(temp_dir) ...
Create and track new temporary directory for browser use. Returns: TemporaryDirectory object for browser --user-data-dir argument.
create_temp_dir
python
autoscrape-labs/pydoll
pydoll/browser/managers/temp_dir_manager.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/managers/temp_dir_manager.py
MIT
def handle_cleanup_error(self, func: Callable[[str], None], path: str, exc_info: tuple): """ Handle errors during directory cleanup with browser-specific workarounds. Args: func: Original function that failed. path: Path that could not be processed. exc_info:...
Handle errors during directory cleanup with browser-specific workarounds. Args: func: Original function that failed. path: Path that could not be processed. exc_info: Exception information tuple. Note: Handles Chromium-specific locked files like...
handle_cleanup_error
python
autoscrape-labs/pydoll
pydoll/browser/managers/temp_dir_manager.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/browser/managers/temp_dir_manager.py
MIT
def reset_permissions( browser_context_id: Optional[str] = None, ) -> Command[Response]: """ Generates a command to reset all permissions. Args: browser_context_id (Optional[str]): The browser context to reset permissions for. If not specified, resets per...
Generates a command to reset all permissions. Args: browser_context_id (Optional[str]): The browser context to reset permissions for. If not specified, resets permissions for the default context. Returns: Command[Response]: The CDP command that returns ...
reset_permissions
python
autoscrape-labs/pydoll
pydoll/commands/browser_commands.py
https://github.com/autoscrape-labs/pydoll/blob/master/pydoll/commands/browser_commands.py
MIT