1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] How do I give a body to a request in process_request?

Discussão em 'Python' iniciado por Stack, Outubro 8, 2024.

  1. Stack

    Stack Membro Participativo

    This is the request I'm trying to give a body in the process_request method: yield scrapy.Request(url=self.url, method='POST', callback=self.parse)

    This is how I tried to do it:

    body = self.body.encode('utf-8') # I've tested the self.body, it contains the value I intended
    request.replace(body=body)


    But this is what I get: INFO: request body: b''

    By the way, in the process_requests I return a None value, as far as I understand that shouldn't be the problem but, maybe I'm confusing something.

    Continue reading...

Compartilhe esta Página