You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class MyBanPolicy(BanDetectionPolicy):
def response_is_ban(self, request, response):
# use default rules, but also consider HTTP 200 responses
ban = super(MyBanPolicy, self).response_is_ban(request, response)
if b'tests' in response.body:
logging.info('test found')
ban = True
return ban
But my check doesnt work because response is I think gzipped
I tried response.css("my selector").get() but I get AttributeError: Response content isn't text error
How can I check existence of an element using response.css() in response_is_ban method?
Do I need to first unzip the response each time? that does not look suitable
PS: I am not sending gzip deflate header to target website at all
Python 3.6.9
Scrapy 2.3.0
The text was updated successfully, but these errors were encountered:
I have created this policy
But my check doesnt work because response is I think gzipped
I tried
response.css("my selector").get()
but I getAttributeError: Response content isn't text
errorHow can I check existence of an element using
response.css()
inresponse_is_ban
method?Do I need to first unzip the response each time? that does not look suitable
PS: I am not sending gzip deflate header to target website at all
Python 3.6.9
Scrapy 2.3.0
The text was updated successfully, but these errors were encountered: