Example #1
0
    def post(self, selector, action_url, payload):

        hidden_fields = utils.get_hidden_fields(selector)

        # Update's the payload with hidden fields
        hidden_fields.update(payload)

        # Makes a POST request with the payload defined
        return http.FormRequest(
            url=action_url,
            formdata=hidden_fields,
            callback=self.wrap_response
        )
Example #2
0
    def crawl(self, selector):
        # Get's the credentials from the spider
        payload = self.spider.get_credentials()

        # Fill the payload with the hidden fields in the html
        hidden_payload = utils.get_hidden_fields(selector)
        payload.update(hidden_payload)

        # Makes a POST request to the login_form_action
        yield http.FormRequest(
            url=self.spider.login_form_action or self.spider.login_url,
            formdata=payload,
            callback=self.handle_response
        )