uamd API Reference

Device detection library via HTTP_USER_AGENT

Introduction

uamd is library for detecting device via HTTP_USER_AGENT.

Currently this library can detect the device listed below

  • DoCoMo mobile phone
  • KDDI mobile phone
  • SoftBank mobile phone
  • iPhone/iPod Touch/iPad
  • Android
  • Internet Explorer
  • Google Chrome
  • Firefox
  • Opera
  • Lunascape

The device doesn’t listed above will treat as device.DummyDevice which will treated as device which support cookie and has no carrier (treated like as PC Browser)

Methods

uamd.detect(meta, loader=<uamd.cidr.DefaultLoader object at 0x8d9c58c>)

Detect device via HTTP Headers and return cidr.Loader instance. When loader is not None, spoof check is executed via loader

Parameters:
  • meta (dict) – the HTTP Headers dict
  • loader (cidr.Loader instance) – cidr.Loader for loading CIDR via carrier for spoof check. set it None to skip spoof check.
Returns:

detected device information as uamd.device.Device subclass instance

Return type:

cidr.device.Device subclass instance

uamd.spoof_check(device, meta, loader=<uamd.cidr.DefaultLoader object at 0x8d9c58c>)

Check whether the device is spoofed via reported carrier’s CIDR. If the device accessed from out of range, then the device may be spoofed so the method will set dev.spoof = True and return the device.

Parameters:
  • device – the device for checking whether spoofed
  • meta (dict) – the HTTP Headers dict
  • loader (cidr.Loader instance) – cidr.Loader for loading CIDR via carrier for spoof check. set it None to skip spoof check.
Returns:

modified(or not modified) device

Return type:

cidr.device.Device subclass instance

Table Of Contents

Previous topic

Device Reference

This Page