導航:首頁 > 編程語言 > 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代理打不開網頁相關的資料

熱點內容
centos7php怎麼用 瀏覽:119
查看linux操作系統版本的命令 瀏覽:382
收支預演算法怎麼做 瀏覽:875
模板如何上傳到伺服器 瀏覽:372
如何同步安卓信息到新ipad 瀏覽:364
騰訊雲輕量伺服器流量警告 瀏覽:503
u盤備份linux 瀏覽:120
高壓縮比活塞 瀏覽:92
壓縮彈簧標准件 瀏覽:25
linux統計個數命令 瀏覽:292
cad轉pdf居中 瀏覽:8
編譯型語言處理過程 瀏覽:325
手機創文件夾復制到電腦 瀏覽:984
有什麼直播APP可以看那種 瀏覽:41
程序員叫什麼人 瀏覽:378
python畫地圖等高線 瀏覽:751
epic永劫無間是什麼伺服器 瀏覽:444
網游伺服器下載地址 瀏覽:107
macphpfreetype安裝 瀏覽:644
設計道pdf 瀏覽:615