Improve bot detection
This commit is contained in:
parent
dba1d368a0
commit
a5219c828b
@ -72,7 +72,11 @@ def ingress_request(
|
|||||||
ua = user_agents.parse(user_agent)
|
ua = user_agents.parse(user_agent)
|
||||||
initial = True
|
initial = True
|
||||||
device_type = "OTHER"
|
device_type = "OTHER"
|
||||||
if ua.is_bot or (ua.browser.family or "").strip() == "Googlebot":
|
if (
|
||||||
|
ua.is_bot
|
||||||
|
or (ua.browser.family or "").strip().lower() == "googlebot"
|
||||||
|
or (ua.device.family or ua.device.model or "").strip().lower() == "spider"
|
||||||
|
):
|
||||||
device_type = "ROBOT"
|
device_type = "ROBOT"
|
||||||
elif ua.is_mobile:
|
elif ua.is_mobile:
|
||||||
device_type = "PHONE"
|
device_type = "PHONE"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user