title: how to a way avoide error "TypeError: a bytes-like object is required, not 'str'" in scrapy
body: <pre><code>    start_urls = ['https://github.com/login']
  
  def parse(self, response):
      return scrapy.FormRequest.from_response(response,formdata={'login': 'xx',
                                              'password': 'xx'},callback=self.after_login)
  
  def after_login(self, response):
      if "authentication failed" in response.body:
         self.logger.info("fail xx %s", response.body)
  </code></pre>
  
  <p>I tried the above code with reference to the document, but the following error occurred.</p>
  
  <pre><code>    if "authentication failed" in response.body:
  TypeError: a bytes-like object is required, not 'str'
  </code></pre>
  
  <p>It looks like binary file in response.body.
  Is there a way to avoid this error?</p>
  
  <p>and I'm Curious that generally, if login fails, whether "authentication failed" is displayed in response.body?</p>
  
  <p>Thank you for reading my question.</p>