
    i              	           d Z ddlmZmZ ddlZddlZddlmZ ddlm	Z	 deez  dej                  d	ej                  d
ej                  dz  fdZy)a  
Method ``http_accept_encoding``
-------------------------------

The ``http_accept_encoding`` method evaluates a request as the request of a
bot if the Accept-Encoding_ header ..

- did not contain ``gzip`` AND ``deflate`` (if both values are missed)
- did not contain ``text/html``

.. _Accept-Encoding:
   https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding

    )IPv4NetworkIPv6NetworkN   )config)too_many_requestsnetworkrequestcfgreturnc                     |j                   j                  dd      j                  d      D cg c]  }|j                          }}d|v sd|v st	        | d      S y c c}w )NzAccept-Encoding ,gzipdeflatez<HTTP header Accept-Encoding did not contain gzip nor deflate)headersgetsplitstripr   )r   r	   r
   laccept_lists        8/root/searxng/searx/botdetection/http_accept_encoding.pyfilter_requestr      sa     '.oo&9&9:KR&P&V&VWZ&[\1779\K\k!Y+%= *hii ]s   A)__doc__	ipaddressr   r   werkzeugflaskr   r   _helpersr   RequestConfigResponser        r   <module>r#      s^    
    '	;&	]]	 
	 		r"   