我使用的代碼片段::Python的機械化:頁面沒有加載完全
br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
response = br.open('http://www.facebook.com')
br.select_form(nr=0)
br['email'] = USERNAME
br['pass'] = PASSWORD
response2 = br.submit()
assert br.viewing_html()
time.sleep(50)
for form in br.forms():
print form
嗯,我試着寫了response2.read()到文件,看看發生了什麼事。只有頂部導航欄已加載。 time.sleep(50)的意圖是爲頁面加載提供時間,但猜測不起作用。
這樣做的正確方法是什麼?
您是否嘗試過使用FB API? – infrared
我知道這可以使用fb api來完成,但是我想嘗試使用機械化 –