Spoofed user agents
A request that says "Googlebot" but comes from a residential proxy should not get crawler treatment.
Use case — Bot verification
Scrapers routinely pretend to be Googlebot to get past rate limits and paywalls. risk.is_crawler checks the address against the ranges and reverse-DNS rules the search and SEO operators publish, so a copied user agent is not enough.
01 — The problem
A request that says "Googlebot" but comes from a residential proxy should not get crawler treatment.
Forward-confirmed reverse DNS is the documented way to verify many crawlers, but doing it on every request needs resolvers, caching and timeouts.
Some publish JSON range files, some HTML pages, some only a hostname suffix. You want one answer.
02 — How it works
{
// …
"country_code": "US",
"asn": "15169",
"risk": {
"is_ai": false,
"is_crawler": true,
"is_scanner": false
}
}
03 — Recipe
Call the API from your server, never from the browser, so your key stays private. Cache answers per IP on your side to save requests.
import os
import requests
CLAIMS = ("googlebot", "bingbot", "applebot", "duckduckbot", "yandex", "baiduspider")
def crawler_status(ip: str, user_agent: str) -> str:
"""'verified', 'unverified' (claims to be a crawler but isn't) or 'not a crawler'."""
r = requests.get(
f"https://fast.ipapi.gr/api/lookup/{ip}",
params={"key": os.environ["IPAPI_KEY"]}, # Pro key
timeout=2,
)
r.raise_for_status()
verified = r.json().get("risk", {}).get("is_crawler", False)
if verified:
return "verified"
if any(name in user_agent.lower() for name in CLAIMS):
return "unverified"
return "not a crawler"
04 — Honest limits
05 — Questions
Look up the client IP. If the user agent claims Googlebot and risk.is_crawler is true, the address is in Google's published crawler ranges. If it is false, treat the request as unverified.
The bot signals coverage page lists every search engine, SEO tool and archive crawler the flag recognises, and how each one is verified.
Yes. The risk flags are returned only for Pro API keys.
Pro: 40,000,000 requests a day with is_ai, is_crawler and is_scanner.