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

熱點內容
電腦文件夾打開自動變為全屏 瀏覽:969
簡易單斷面計演算法 瀏覽:850
php社區程序 瀏覽:976
python現在就業怎麼樣 瀏覽:304
php上傳目錄許可權設置 瀏覽:736
php合同檔案管理系統 瀏覽:366
tshock伺服器地址 瀏覽:877
php解析文件流 瀏覽:780
伺服器機箱銅片有什麼用 瀏覽:969
樂視手機如何使用原生態安卓 瀏覽:215
dns伺服器怎麼備份啊 瀏覽:865
蘋果退款app怎麼重新購買 瀏覽:655
U盤cmd檢查文件夾成文件 瀏覽:66
java路徑是否存在 瀏覽:338
新氧app上怎麼測臉型 瀏覽:787
用指令獲得命令方塊 瀏覽:427
流星蝴蝶劍怎麼輸入命令 瀏覽:681
keil有紅叉但是能編譯通過 瀏覽:498
賽拉圖的空調壓縮機多少錢 瀏覽:330
linux54 瀏覽:986