The 51Degrees Python Device Detector provides fast, accurate and consistent results for real time device detection. All source code and 51Degrees Lite Device Data is licensed under the Mozilla Public License version 2.
Two device detection methods are available with the Python solution.
Pattern is the same matching method used by our .NET, Java and
PHP APIs. However all the necessary data, regular expressions and other
pattern recognition methods are provided in the 51Degrees.com.c source
code file. This results in a faster implementation of the method
requiring very little working memory. The pattern method is ideally
suited to real time device detection for web sites. As all the detection
logic and data is compiled into the executable a recompilation will be
required when updates are provided. Therefore the optimal implementation
is via dynamic rather than static linking.
Trie indexes require a significant amount of data and are therefore less memory efficient than the pattern matching method. However they are exceptionally fast achieving millions of detections per second. The trie method is suitable for offline analysis of log files or web sites receiving millions of unique requests per minute from an extremely large range of devices.
To understand more about the differences between Trie and Pattern detection read how detection works.