POST请求

from scrapy.http import FormRequest

#replace the start_urls statement with a start_requests() method
def start_requests(self):
return [ FormRequest(
"http://web:9312/dynamic/login", formdata={"user": "user", "pass": "pass"}

确认启用了Cookie

# Start on the welcome page def start_requests(self):
return [
Request(
"http://web:9312/dynamic/nonce", callback=self.parse_welcome)
]

# Post welcome page's first form with the given user/pass def parse_welcome(self, response):
return FormRequest.from_response( response,
formdata={"user": "user", "pass": "pass"}

 

posted @ 2017-12-13 09:58  不可叽叽歪歪  阅读(118)  评论(0编辑  收藏  举报