{"id":21076,"library":"crawlerdetect","title":"CrawlerDetect","description":"CrawlerDetect is a Python library for identifying bots, crawlers, and spiders by analyzing user agent strings. It is a port of the PHP Crawler-Detect library. Current version is 0.3.2, released infrequently.","status":"active","version":"0.3.2","language":"python","source_language":"en","source_url":"https://github.com/moskrc/crawlerdetect","tags":["crawler-detection","bot-detection","user-agent"],"install":[{"cmd":"pip install crawlerdetect","lang":"bash","label":"PyPI"}],"dependencies":[],"imports":[{"note":"Main class for detecting crawlers.","symbol":"CrawlerDetect","correct":"from crawlerdetect import CrawlerDetect"}],"quickstart":{"code":"from crawlerdetect import CrawlerDetect\n\ndetector = CrawlerDetect()\nuser_agent = \"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)\"\nis_crawler = detector.is_crawler(user_agent)\nprint(f\"Is crawler: {is_crawler}\")  # True","lang":"python","description":"Basic usage: create a CrawlerDetect instance and call is_crawler with a user agent string."},"warnings":[{"fix":"Fork or extend the library to update the signatures from the PHP source.","message":"The library uses a static list of crawler signatures. If you need custom detection or real-time updates, you must manage the data file yourself.","severity":"gotcha","affected_versions":"all"},{"fix":"Pass the raw user agent string as obtained from request headers.","message":"User agent parsing may be case-sensitive. Ensure you pass the exact user agent string without modification.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `from crawlerdetect import CrawlerDetect`.","message":"Older versions used a different import pattern (e.g., from crawlerdetect import CrawlerDetect as cd). This still works but is deprecated in favor of the direct import.","severity":"deprecated","affected_versions":"<0.3.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `pip install crawlerdetect` in the correct Python environment.","cause":"Library not installed or installed in a different environment.","error":"ModuleNotFoundError: No module named 'crawlerdetect'"},{"fix":"Upgrade to latest version: `pip install --upgrade crawlerdetect`. Then use `from crawlerdetect import CrawlerDetect`.","cause":"Using an outdated version or incorrect import statement.","error":"AttributeError: module 'crawlerdetect' has no attribute 'CrawlerDetect'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}