Я пытался подключиться к tor с помощью python на Mac.Если это поможет, у меня есть Python3 и Mac Mojave.Мой код:
import stem.process
from stem import Signal
from stem.control import Controller
from splinter import Browser
proxyIP = "127.0.0.1"
proxyPort = 9150
proxy_settings = {"network.proxy.type":1,
"network.proxy.ssl": proxyIP,
"network.proxy.ssl_port": proxyPort,
"network.proxy.socks": proxyIP,
"network.proxy.socks_port": proxyPort,
"network.proxy.socks_remote_dns": True,
"network.proxy.ftp": proxyIP,
"network.proxy.ftp_port": proxyPort
}
browser = Browser('firefox', profile_preferences=proxy_settings)
browser.visit("http://www.icanhazip.com")
Однако всякий раз, когда я запускаю его, возникает ошибка:
Traceback (most recent call last):
File "test.py", line 27, in <module>
browser = Browser('firefox', profile_preferences=proxy_settings)
File "/usr/local/lib/python3.6/site-packages/splinter/browser.py", line 64, in Browser
return driver(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/splinter/driver/webdriver/firefox.py", line 78, in __init__
**kwargs
File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
keep_alive=True)
File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
Любая помощь будет принята с благодарностью.С уважением, Тайлер