Skip to main content

A python package to add authenticated proxy support to selenium.

Project description

Selenium Authenticated Proxy Helper

Overview

The Selenium Authenticated Proxy Helper is a Python utility designed to seamlessly handle proxy authentication when using Selenium WebDriver. This package generates a Chrome extension that takes care of proxy authentication, allowing you to focus more on web scraping or automation tasks, without worrying about the intricacies of proxy setup.

Features

  • Proxy Authentication: Supports username and password authentication for proxy servers.
  • Unique Identification: Generates a unique Chrome extension for each different set of proxy credentials.
  • Ease of Use: Simple API to generate and use the extension with your existing Selenium Chrome WebDriver setup.
  • Temporary Storage: Optionally, specify a folder for temporary storage of generated Chrome extensions.

Requirements

  • Python 3.6 or higher
  • Selenium WebDriver

Installation

You can install this package via pip:

pip install selenium-authenticated-proxy

Usage

Basic Usage

Here is how you can set up the authenticated proxy for Selenium's Chrome WebDriver:

from selenium import webdriver
from selenium_authenticated_proxy import SeleniumAuthenticatedProxy

# Initialize Chrome options
chrome_options = webdriver.ChromeOptions()

# Initialize SeleniumAuthenticatedProxy
proxy_helper = SeleniumAuthenticatedProxy(proxy_url="http://username:password@proxy-server.com")

# Enrich Chrome options with proxy authentication
proxy_helper.enrich_chrome_options(chrome_options)

# Start WebDriver with enriched options
driver = webdriver.Chrome(chrome_options=chrome_options)

# Your automation or scraping code here

Custom Temporary Folder

You can specify a custom folder for temporary storage of generated Chrome extensions.

proxy_helper = SeleniumAuthenticatedProxy(proxy_url="http://username:password@proxy-server.com", tmp_folder="/path/to/tmp/folder")

To enable the authentication to work properly a chrome extension is being generated (Thanks to itsmnthn with an improvement for manifest v3). If the URl doesn't change the extension will not be regenerated. The URL is hashed so that only when the URL has changed (or the tmp folder has changed) a new zip file will be generated.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

selenium_authenticated_proxy-1.0.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file selenium_authenticated_proxy-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for selenium_authenticated_proxy-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 493ebaa5a9e0f9e747eea921730768985efaf408fb7f47c2d82476359d3a14ec
MD5 572780986f76a4b892cf31d03c54d028
BLAKE2b-256 1a44ca81d24b1f877e09e46513f9ce5309b4495a9806c443b0b801afdb57becd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page