## About CrawlerDetect
CrawlerDetect is a Python version of PHP class @[CrawlerDetect](https://github.com/JayBizzle/Crawler-Detect).
It helps to detect bots/crawlers/spiders via the user agent and other HTTP-headers. Currently able to detect 1,000’s of bots/spiders/crawlers.
### Installation Run pip install crawlerdetect
### Usage
#### Variant 1 `Python from crawlerdetect import CrawlerDetect crawler_detect = CrawlerDetect() crawler_detect.isCrawler('Mozilla/5.0 (compatible; Sosospider/2.0; +http://help.soso.com/webspider.htm)') # true if crawler user agent detected `
#### Variant 2 `Python from crawlerdetect import CrawlerDetect crawler_detect = CrawlerDetect(user_agent='Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X) AppleWebKit (KHTML, like Gecko) Mobile (compatible; Yahoo Ad monitoring; https://help.yahoo.com/kb/yahoo-ad-monitoring-SLN24857.html)') crawler_detect.isCrawler() # true if crawler user agent detected `
#### Variant 3 `Python from crawlerdetect import CrawlerDetect crawler_detect = CrawlerDetect(headers={'DOCUMENT_ROOT': '/home/test/public_html', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': '*/*', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_CACHE_CONTROL': 'no-cache', 'HTTP_CONNECTION': 'Keep-Alive', 'HTTP_FROM': 'googlebot(at)googlebot.com', 'HTTP_HOST': 'www.test.com', 'HTTP_PRAGMA': 'no-cache', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36', 'PATH': '/bin:/usr/bin', 'QUERY_STRING': 'order=closingDate', 'REDIRECT_STATUS': '200', 'REMOTE_ADDR': '127.0.0.1', 'REMOTE_PORT': '3360', 'REQUEST_METHOD': 'GET', 'REQUEST_URI': '/?test=testing', 'SCRIPT_FILENAME': '/home/test/public_html/index.php', 'SCRIPT_NAME': '/index.php', 'SERVER_ADDR': '127.0.0.1', 'SERVER_ADMIN': 'webmaster@test.com', 'SERVER_NAME': 'www.test.com', 'SERVER_PORT': '80', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SIGNATURE': '', 'SERVER_SOFTWARE': 'Apache', 'UNIQUE_ID': 'Vx6MENRxerBUSDEQgFLAAAAAS', 'PHP_SELF': '/index.php', 'REQUEST_TIME_FLOAT': 1461619728.0705, 'REQUEST_TIME': 1461619728}) crawler_detect.isCrawler() # true if crawler user agent detected ` #### Output the name of the bot that matched (if any) `Python from crawlerdetect import CrawlerDetect crawler_detect = CrawlerDetect() crawler_detect.isCrawler('Mozilla/5.0 (compatible; Sosospider/2.0; +http://help.soso.com/webspider.htm)') # true if crawler user agent detected crawler_detect.getMatches() # Sosospider `
### Contributing If you find a bot/spider/crawler user agent that CrawlerDetect fails to detect, please submit a pull request with the regex pattern added to the array in providers/crawlers.py and add the failing user agent to tests/crawlers.txt.
Failing that, just create an issue with the user agent you have found, and we’ll take it from there :)
### ES6 Library To use this library with NodeJS or any ES6 application based, check out [es6-crawler-detect](https://github.com/JefferyHus/es6-crawler-detect).
### .NET Library To use this library in a .net standard (including .net core) based project, check out [NetCrawlerDetect](https://github.com/gplumb/NetCrawlerDetect).
### Nette Extension To use this library with the Nette framework, checkout [NetteCrawlerDetect](https://github.com/JanGalek/Crawler-Detect).
### Ruby Gem
To use this library with Ruby on Rails or any Ruby-based application, check out [crawler_detect](https://github.com/loadkpi/crawler_detect) gem.
_Parts of this class are based on the brilliant [MobileDetect](https://github.com/serbanghita/Mobile-Detect)_
[](https://github.com/JayBizzle/Crawler-Detect)
Metadata
Release files for crawlerdetect 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| CrawlerDetect-0.1.2.tar.gz | 15.6 kB | Without provenance | Details for CrawlerDetect-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| CrawlerDetect-0.1.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for CrawlerDetect-0.1.2-py2.py3-none-any.whl |
Total release size: 32.6 kB
Release files / CrawlerDetect-0.1.2.tar.gz
| Download URL | CrawlerDetect-0.1.2.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ba2a7528983c39049dac99d9f419ce429e5aaf20092f41f076ca7290ffbe553
|
|
BLAKE2b-256 checksum How to use checksums |
41416595d07297195c39ebe8fa6f0d54ea0657e577ecaf799963341841475652
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.6
|
Release files / CrawlerDetect-0.1.2-py2.py3-none-any.whl
| Download URL | CrawlerDetect-0.1.2-py2.py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
b961980570c044a9929405652a9658dee53ca10afca17cc2a4feb4c57ec4bc1e
|
|
BLAKE2b-256 checksum How to use checksums |
139c2b2c33b046fd649e48ea7c247e363bbce71c43469e93c968c1ef1aa757bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.5
|
Security for crawlerdetect 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.