Socket
Socket
Sign inDemoInstall

django-mobileesp

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    django-mobileesp

Detect request's mobile user agents using the mobileesp lib.


Maintainers
1

Readme

===================================== Django Mobileesp

Basic usage

settings.py

::

MIDDLEWARE_CLASSES = (
    ...
    'django_mobileesp.middleware.UserAgentDetectionMiddleware'
)

from django_mobileesp.detector import mobileesp_agent as agent

DETECT_USER_AGENTS = {
    'is_android': agent.detectAndroid,
    'is_ios': agent.detectIos,
    'is_windows_phone': agent.detectWindowsPhone,
    'is_mobile': agent.detectTierTablet | \
                      agent.detectTierIphone | \
                      agent.detectMobileQuick,
}

If you prefer more pythonic methods, you can user a wrapper agent as follows:

::

from django_mobileesp.detector import python_agent as agent

DETECT_USER_AGENTS = {
    'is_android': agent.detect_android,
    'is_ios': agent.detect_ios,
    'is_windows_phone': agent.detect_windows_phone,
    'is_mobile': agent.detect_tier_tablet | \
                      agent.detect_tier_iphone | \
                      agent.detect_mobile_quick,
}

Finally access the defined attributes in your views:

::

def view(request):
    if request.is_mobile:
        ...

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc