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

熱點內容
高爾夫電台怎麼添加到文件夾 瀏覽:237
四川麻將一般下哪個app 瀏覽:862
反編譯exe腳本 瀏覽:460
源碼文件夾怎麼編譯到固件中 瀏覽:910
ERp列印伺服器錯誤怎麼弄 瀏覽:111
蚌埠u盤加密軟體有哪些 瀏覽:178
前端如何認證伺服器 瀏覽:554
linux切換db2用戶命令 瀏覽:306
相片如何用電解壓 瀏覽:906
碩士程序員去學校當老師 瀏覽:120
pythonstr提取到字典 瀏覽:818
程序員那麼可愛有人看上陸漓了 瀏覽:876
php正則提取圖片 瀏覽:105
pythonlinuxdjango 瀏覽:562
php中文返回亂碼 瀏覽:89
宿舍裝的電信怎麼加密 瀏覽:745
為什麼壓縮文件解壓後變少了 瀏覽:426
現在安卓充電器普遍是什麼型號 瀏覽:714
9日均線36均線主圖指標源碼 瀏覽:351
程序員阿里文化完整版 瀏覽:98