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

熱點內容
什麼編譯器可以帶c11函數 瀏覽:18
如何理解程序員對自己電腦的感情 瀏覽:525
什麼是簡訊app 瀏覽:752
我的世界伺服器啟動器下載地址 瀏覽:790
雲伺服器公ip和內ip 瀏覽:948
手機淘寶app授權在哪裡 瀏覽:472
匯編程序的任務 瀏覽:973
dji編程玩具 瀏覽:21
dcs伺服器異常現象是什麼 瀏覽:201
java中的布局 瀏覽:702
單片機作業三 瀏覽:161
古代分數運演算法則 瀏覽:154
電腦大文件夾查找方法 瀏覽:938
什麼app可以買國外衣服 瀏覽:385
媽媽吃了命令葯丸 瀏覽:714
男的進國企做程序員 瀏覽:994
程序員的數學線性代數 瀏覽:373
冰箱壓縮機啟動器盒怎麼拆 瀏覽:443
雪崩pdf 瀏覽:952
桂林銀行app如何查詢積分和等級 瀏覽:285