刮取JavaScript WEB页面需要HTTP基本身份验证

时间:2015-01-28 14:16:07

标签: python authentication web-scraping pyqt4

我试图编写访问由身份验证机制保护的JavaScript页面的脚本。

当我执行以下操作时:

r = requests.get(url1, auth=('user', 'password'))

...它顺利通过了身份验证,但由于该页面是由JavaScript代码生成的,因此它为我提供了代码而不是HTML内容:

u'<SCRIPT Language=Javascript>\r\nif (window.navigator.cookieEnabled == true)\r\n{\r\nvar gmtString, d;\r\nvar vDay, vDate, vMonth, vYear, vHour;\r\nvar x = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");\r\nvar y = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");\r\nd = new Date();\r\nvDay = d.getDay();\r\nvDate = d.getDate();\r\nvMonth = d.getMonth();\r\nv

另一方面,我试图使用PyQt4来解决这个问题,就像它解释here一样。它应该工作,但这次我没有设法通过身份验证。

有人能指出正确的方向吗?

0 个答案:

没有答案