我正在尝试使用scrapy在登录会话下额外添加一些数据。通常当我拦截数据时,我可以在网络选项卡中查看格式数据。在此登录页面中,当提交登录时,我似乎无法找到格式数据选项卡。
https://lumen.ni.com/nicif/login.xhtml
有人可以建议吗?
我目前的实施:
import scrapy
from scrapy import FormReuest
class LoginSpider(scrapy.Spider):
name = 'example.com'
def start_requests(self):
return [scrapy.FormRequest("https://lumen.ni.com/nicif/login.xhtml",
formdata={'LoginForm:email': 'email', 'LoginForm:password': 'password'},
callback=self.logged_in)]
def logged_in(self, response):
if("Please use correct email & password combination") in str(response.body):
print("fail")
else:
data = {'p_part_number':'779494-01','p_duration':'','p_duration_uom':''}
yield FormRequest(url="http://sine.ni.com/apps/utf8/nipp.purchase_form_ajax", formdata=data)