例如,我想將用戶名和密碼後,下載此頁:如何下載需要用戶名和密碼的網頁?
http://forum.ubuntu-it.org/
我與wget的tryed,但不起作用。
python是否有解決方案?
你可以用這些用戶名和密碼進行測試:
username: johnconnor
password: hellohello
例如,我想將用戶名和密碼後,下載此頁:如何下載需要用戶名和密碼的網頁?
http://forum.ubuntu-it.org/
我與wget的tryed,但不起作用。
python是否有解決方案?
你可以用這些用戶名和密碼進行測試:
username: johnconnor
password: hellohello
像@robert說的,使用機械化。
爲了讓你開始:
from mechanize import Browser
b = Browser()
b.open("http://forum.ubuntu-it.org/index.php")
b.select_form(nr=0)
b["user"] = "johnconnor"
b["passwrd"] = "hellohello"
b.submit()
response = b.response().read()
if "Salve <b>johnconnor</b>" in response:
print "Logged in!"
嘗試mechanize模塊。它基本上是一個編程式瀏覽器界面。
[wget的身份驗證]的可能重複(http://stackoverflow.com/questions/4272770/wget-with-authentication) – Gareth 2010-11-25 10:33:28
複製所有這些的:HTTP ://stackoverflow.com/search?q =%5Bpython%5D + urllib2 +表單搜索幫助。用它。 – 2010-11-25 12:37:12
[Python驗證與urllib2]可能重複(http://stackoverflow.com/questions/1014570/python-authentication-with-urllib2) – 2010-11-25 12:38:44