How to use a socks5 proxy with authentication via selenium 4, Python and Firefox (options)
It looks like Firefox does not accept user/password auth for socks5 proxy at this time, see: https://github.com/mozilla/geckodriver/issues/1872
The bug/feature is being tracked here: https://bugzilla.mozilla.org/show_bug.cgi?id=1395886
Selenium is aware of this issue here: https://github.com/SeleniumHQ/selenium/issues/7911
For now the solution I've used as an alternative is to use no authentication on my proxy and then use ufw
on the server to block all IPs except for the designated ones.
Python selenium - Proxy connection with host, port, username, password
Dup of: How to set proxy AUTHENTICATION username:password using Python/Selenium
Selenium-wire: https://github.com/wkeeling/selenium-wire
Install selenium-wire
pip install selenium-wire
Import itfrom seleniumwire import webdriver
Auth to proxyoptions = {
'proxy': {
'http': 'http://username:password@host:port',
'https': 'https://username:password@host:port',
'no_proxy': 'localhost,127.0.0.1,dev_server:8080'
}
}
driver = webdriver.Firefox(seleniumwire_options=options)
WarningTake a look to the selenium-wire cache folder. I had a problem because it take all my disk space. You have to remove it sometimes in your script when you want.
Related Topics
Loading Initial Data with Django 1.7 and Data Migrations
Pycharm: Set Environment Variable for Run Manage.Py Task
Does 'Anaconda' Create a Separate Pythonpath Variable for Each New Environment
How to Know/Change Current Directory in Python Shell
How to Plot Empirical Cdf (Ecdf)
Get the String Within Brackets in Python
Convert Date to Datetime in Python
Continuing in Python's Unittest When an Assertion Fails
Return List of Items in List Greater Than Some Value
Generate Rfc 3339 Timestamp in Python
Django - Makemigrations - No Changes Detected
How to Save Final Model Using Keras
How to Have Shared Log Files Under Windows
Mapping a Range of Values to Another