• About Us
  • Blog
  • Basket
  • Account
  • Sign In
  •  

References

The API of the 51Degrees.com Mobile Detector for Python is composed by a single matching method:

           match(user_agent, client_ip=None, http_headers=None, method=None)

This method will always return a "Device" instance encapsulating the properties of the detected device. "user_agent" is the only mandatory argument. Other arguments are:

"client_ip" is a string with the client IP address. If provided and the "USER_SHARER_ENABLED" option is enabled in your settings, it will be submitted to 51Degrees.com in order to improve performance and accuracy of further device detections.

"http_headers" is a dictionary containing all HTTP headers. If provided and the "USER_SHARER_ENABLED" option is in enabled in your settings, it will be submitted (removing confidential data such as cookies) to 51Degrees.com in order to improve performance and accuracy of further device detections.

"method" is a string with the desired device detection method ("lite-pattern-wrapper", "premium-pattern-wrapper" or "trie-wrapper"). If not specified, value of "DETECTION_METHOD" in your settings file will be used as the default detection method.

Need Help?