導航:首頁 > 編程語言 > python代理打不開網頁

python代理打不開網頁

發布時間:2024-05-13 16:56:58

python 製作網頁打不開 直接跳到打開或者保存文件

需要對Lighttpd進行配置,指明py文件是作為cgi程序運行的。
修改配置文件:/etc/lighttpd/lighttpd.conf
在以下小節內添加python內容:
server.moles = ( "mod_cgi", )
cgi.assign = (
".py" => "/usr/bin/python"
)

Ⅱ python鍙浠ョ敤鑷鍔ㄥ寲鎵撲笉寮嫻忚堝櫒

闇瑕佷笅杞藉畨瑁単eckodriver, 鐒跺悗灝嗗叾鍔犲叆鐜澧冨彉閲.
Zidon鍒板崥瀹㈢粰浣犳惉榪囨潵浜

selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
version: selenium==3.0.1
姝ょ増鏈鎵ц岄渶瑕侀┍鍔錛歡eckodriver
鍙浠ュ幓緗戝潃https://github.com/mozilla/geckodriver/releases 榪欓噷涓嬭澆鏈鏂扮殑鐗堟湰銆
鐒跺悗灝嗘枃浠跺す瑙e帇鍒癈:\geckodriver澶勶紝鍐嶅炲姞鍦ㄧ數鑴戣劇疆鐜澧冨彉閲忥紝濡備笅鍥炬墍紺

鐒跺悗鍦ㄥ壋寤篎irefox鐨勬椂鍊欒劇疆鎵ц岃礬寰
browser = webdriver.Firefox(executable_path = 'C:\geckodriver\geckodriver.exe')
Traceback (most recent call last): File "C:\learnplace\python_webdevelop_testdriver\functional_tests.py", line 10, in <mole>
browser = webdriver.Firefox() File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 135, in __init__ self.service.start() File "C:\Python27\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x00000000030E7CF8>> ignored

涓嶈繃姝ゆ椂浼氬嚭鐜板彟澶栦竴涓寮傚父錛
Traceback (most recent call last): File "C:\learnplace\python_webdevelop_testdriver\functional_tests.py", line 10, in <mole>
browser = webdriver.Firefox(executable_path = 'C:\geckodriver\geckodriver.exe') File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 145, in __init__
keep_alive=True) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 92, in __init__ self.start_session(desired_capabilities, browser_profile) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 179, in start_session
response = self.execute(Command.NEW_SESSION, capabilities) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
self.error_handler.check_response(response) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line

闇瑕佸皢binary鐨勬祻瑙堝櫒璺寰勬坊鍔犱互涓
from selenium import webdriverfrom selenium.webdriver.firefox.firefox_binary import FirefoxBinary# browser = webdriver.Firefox(# firefox_binary='C:\Program Files (x86)\Mozilla Firefox')# browser.get('http://localhost:8000')# assert 'Django' in browser.titlebinary = FirefoxBinary(r'C:\Program Files (x86)\Mozilla Firefox\firefox.exe')
browser = webdriver.Firefox(firefox_binary=binary)
browser.get('http://localhost:8000')

涓嶈繃鍙堝嚭鐜頒互涓嬪紓甯搞傘傘
Traceback (most recent call last): File "C:\learnplace\python_webdevelop_testdriver\functional_tests.py", line 18, in <mole>
browser = webdriver.Firefox(firefox_binary=binary) File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 145, in __init__
keep_alive=True) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 92, in __init__ self.start_session(desired_capabilities, browser_profile) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 179, in start_session
response = self.execute(Command.NEW_SESSION, capabilities) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
self.error_handler.check_response(response) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Unsupported Marionette protocol version 2, required 3

浠ヤ笂闂棰樺彧瑕佹洿鏂癴irefox鍒47鐗堟湰灝卞彲浠ヤ簡銆傜粓浜庤В鍐充簡銆傘
浣跨敤PhantomJS 鏃犲ご嫻忚堝櫒
self.browser = webdriver.PhantomJS(executable_path=r'C:\phantomjs\bin\phantomjs.exe')

Ⅲ python爬蟲怎麼處理豆瓣網頁異常請求

1.URLError

首先解釋下URLError可能產生的原因:

閱讀全文

與python代理打不開網頁相關的資料

熱點內容
如何下載老友麻將app 瀏覽:443
java路徑參數 瀏覽:590
php命名空間使用 瀏覽:296
app的競爭力如何寫 瀏覽:585
linux刪除swp 瀏覽:588
pdfxchange40 瀏覽:75
車牌號碼是哪個app 瀏覽:48
文件夾如何添加圓點 瀏覽:729
如何建立主索引命令 瀏覽:599
mac電腦怎麼打開終端命令 瀏覽:741
androidvpn待機不斷 瀏覽:756
硬碟的文件夾如何設置密碼 瀏覽:384
plc定位編程 瀏覽:47
mac命令添加用戶 瀏覽:815
android時間widget 瀏覽:393
qd128h壓縮機參數 瀏覽:287
用單片機測車距 瀏覽:394
去哪裡找加密的便簽 瀏覽:19
武漢訂酒店旅館哪個app平台好 瀏覽:114
c語言在線編譯器位元組流 瀏覽:317