2017-06-22 44 views
0

我正在做webscraper登錄到一個網站,當我登錄我收到beautifulSoup錯誤,我不知道如何解決,以及對象錯誤,我也感到困惑。我一直在看網頁教程颳了一會兒,真正需要幫助的Robobrowser BeautifulSoup錯誤

from robobrowser import RoboBrowser 
browser = RoboBrowser() 
login_url = 'http://netacad.com/login' 
browser.open(login_url) 
form = browser.get_form(id='f') 
form['username'].value = "username" 
form['password'].value = "password" 
browser.submit_form(form) 

錯誤

The code that caused this warning is on line 10 of the file C:\Program Files (x86)\Wing IDE 101 6.0\bin\wingdb.py. To get rid of this warning, change code that looks like this: 

BeautifulSoup(YOUR_MARKUP}) 

to this: 

BeautifulSoup(YOUR_MARKUP, "html.parser") 

    markup_type=markup_type)) 
Traceback (most recent call last): 
    File "C:/Users/Leon/Desktop/retrieve.py", line 6, in <module> 
    form['username'].value = "username" 
builtins.TypeError: 'NoneType' object is not subscriptable 
+0

你得到什麼錯誤?如果你沒有清楚地解釋你的問題,人們會如何幫助你? –

+0

我真的很笨,哈哈真的很深夜。當我回家時我會放下它 – leon

回答

1

試試:

browser = RoboBrowser(parser='html.parser')