Search code examples
pythonweb-scrapingencodingserverscrapy

Scrapy response is an Invalid/Unknown String


Good day, I'm having some issues with a scrapy script I wrote. The code works perfectly on my local machine, but when I run it on an ubuntu server, I'm getting response like this

c\x00�^\x00@6Us�e�yV�\x17~J��'\x1d$B2c�����5��F8\x10��M#[�(\nxm��C���p�\x05R [��\x00\x02v`,/�\x00��˛��Pv�p+ �1\rgq�p��\x15��\x18�/��\x01mQ

Response code is ok. But the text is the above unreadable sequence


Solution

  • You are getting compressed data.

    Remove the Accept-Encoding line from your headers and try again.

    If it doesn't work try to set Accept-Encoding: deflate.