{ "info": { "author": "Selwin Ong", "author_email": "selwin.ong@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Python User Agents\n==================\n\n``user_agents_next`` is a Python library that provides an easy way to\nidentify/detect devices like mobile phones, tablets and their\ncapabilities by parsing (browser/HTTP) user agent strings. The goal is\nto reliably detect whether:\n\n- User agent is a mobile, tablet or PC based device\n- User agent has touch capabilities (has touch screen)\n\n``user_agents_next`` relies on the excellent\n`ua-parser-next `_ to do the actual\nparsing of the raw user agent string.\n\nInstallation\n------------\n\n.. figure:: https://travis-ci.org/soon/python-user-agents-next.svg?branch=master\n :alt: Build status\n\n Build status\n\n``user-agents-next`` is hosted on\n`PyPI `__ and can be installed\nas such:\n\n::\n\n pip install user-agents-next\n\nAlternatively, you can also get the latest source code from\nGithub_ and install it manually.\n\n.. _Github: https://github.com/soon/python-user-agents-next\n\nUsage\n-----\n\nVarious basic information that can help you identify visitors can be\naccessed ``browser``, ``device`` and ``os`` attributes. For example:\n\n.. code:: python\n\n\n from user_agents_next import parse\n\n # iPhone's user agent string\n ua_string = 'Mozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B179 Safari/7534.48.3'\n user_agent = parse(ua_string)\n\n # Accessing user agent's browser attributes\n user_agent.browser # returns Browser(family=u'Mobile Safari', version=(5, 1), version_string='5.1')\n user_agent.browser.family # returns 'Mobile Safari'\n user_agent.browser.version # returns (5, 1)\n user_agent.browser.version_string # returns '5.1'\n\n # Accessing user agent's operating system properties\n user_agent.os # returns OperatingSystem(family=u'iOS', version=(5, 1), version_string='5.1')\n user_agent.os.family # returns 'iOS'\n user_agent.os.version # returns (5, 1)\n user_agent.os.version_string # returns '5.1'\n\n # Accessing user agent's device properties\n user_agent.device # returns Device(family=u'iPhone', brand=u'Apple', model=u'iPhone')\n user_agent.device.family # returns 'iPhone'\n user_agent.device.brand # returns 'Apple'\n user_agent.device.model # returns 'iPhone'\n\n # Viewing a pretty string version\n str(user_agent) # returns \"iPhone / iOS 5.1 / Mobile Safari 5.1\"\n\n``user_agents_next`` also expose a few other more \"sophisticated\" attributes\nthat are derived from one or more basic attributes defined above. As for\nnow, these attributes should correctly identify popular\nplatforms/devices, pull requests to support smaller ones are always\nwelcome.\n\nCurrently these attributes are supported:\n\n- ``is_mobile``: whether user agent is identified as a mobile phone\n (iPhone, Android phones, Blackberry, Windows Phone devices etc)\n- ``is_tablet``: whether user agent is identified as a tablet device\n (iPad, Kindle Fire, Nexus 7 etc)\n- ``is_pc``: whether user agent is identified to be running a\n traditional \"desktop\" OS (Windows, OS X, Linux)\n- ``is_touch_capable``: whether user agent has touch capabilities\n- ``is_bot``: whether user agent is a search engine crawler/spider\n\nFor example:\n\n.. code:: python\n\n\n from user_agents_next import parse\n\n # Let's start from an old, non touch Blackberry device\n ua_string = 'BlackBerry9700/5.0.0.862 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/331 UNTRUSTED/1.0 3gpp-gba'\n user_agent = parse(ua_string)\n user_agent.is_mobile # returns True\n user_agent.is_tablet # returns False\n user_agent.is_touch_capable # returns False\n user_agent.is_pc # returns False\n user_agent.is_bot # returns False\n str(user_agent) # returns \"BlackBerry 9700 / BlackBerry OS 5 / BlackBerry 9700\"\n\n # Now a Samsung Galaxy S3\n ua_string = 'Mozilla/5.0 (Linux; U; Android 4.0.4; en-gb; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30'\n user_agent = parse(ua_string)\n user_agent.is_mobile # returns True\n user_agent.is_tablet # returns False\n user_agent.is_touch_capable # returns True\n user_agent.is_pc # returns False\n user_agent.is_bot # returns False\n str(user_agent) # returns \"Samsung GT-I9300 / Android 4.0.4 / Android 4.0.4\"\n\n # iPad's user agent string\n ua_string = 'Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10'\n user_agent = parse(ua_string)\n user_agent.is_mobile # returns False\n user_agent.is_tablet # returns True\n user_agent.is_touch_capable # returns True\n user_agent.is_pc # returns False\n user_agent.is_bot # returns False\n str(user_agent) # returns \"iPad / iOS 3.2 / Mobile Safari 4.0.4\"\n\n # Kindle Fire's user agent string\n ua_string = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-80) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true'\n user_agent = parse(ua_string)\n user_agent.is_mobile # returns False\n user_agent.is_tablet # returns True\n user_agent.is_touch_capable # returns True\n user_agent.is_pc # returns False\n user_agent.is_bot # returns False\n str(user_agent) # returns \"Kindle / Android / Amazon Silk 1.1.0-80\"\n\n # Touch capable Windows 8 device\n ua_string = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; Touch)'\n user_agent = parse(ua_string)\n user_agent.is_mobile # returns False\n user_agent.is_tablet # returns False\n user_agent.is_touch_capable # returns True\n user_agent.is_pc # returns True\n user_agent.is_bot # returns False\n str(user_agent) # returns \"PC / Windows 8 / IE 10\"\n\nRunning Tests\n-------------\n\n::\n\n python -m unittest discover\n\nChangelog\n---------\n\nVersion 1.1.0\n~~~~~~~~~~~~~\n\n- Updated ua-parser-next to 0.9.0\n\n~~~~~~~~~~~~~\n\n- Fixes packaging issue\n\nVersion 1.0\n~~~~~~~~~~~\n\n- Adds compatibility with ``ua-parser`` 0.4.0\n- Access to more device information in ``user_agent.device.brand`` and\n ``user_agent.device.model``\n\n===\n\nVersion 0.3.2\n~~~~~~~~~~~~~\n\n- Better mobile detection\n- Better PC detection\n\nVersion 0.3.1\n~~~~~~~~~~~~~\n\n- user\\_agent.is\\_mobile returns True when mobile spider is detected\n\nVersion 0.3.0\n~~~~~~~~~~~~~\n\n- Added **str**/**unicode** methods for convenience of pretty string\n\nVersion 0.2.0\n~~~~~~~~~~~~~\n\n- Fixed errors when running against newer versions if ua-parser\n- Support for Python 3\n\nVersion 0.1.1\n~~~~~~~~~~~~~\n\n- Added ``is_bot`` property\n- Symbian OS devices are now detected as a mobile device\n\nVersion 0.1\n~~~~~~~~~~~\n\n- Initial release\n\nDeveloped by the cool guys at `Stamps `__.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/soon/python-user-agents-next", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "user-agents-next", "package_url": "https://pypi.org/project/user-agents-next/", "platform": "", "project_url": "https://pypi.org/project/user-agents-next/", "project_urls": { "Homepage": "https://github.com/soon/python-user-agents-next" }, "release_url": "https://pypi.org/project/user-agents-next/1.1.3/", "requires_dist": null, "requires_python": "", "summary": "A library to identify devices (phones, tablets) and their capabilities by parsing (browser/HTTP) user agent strings", "version": "1.1.3" }, "last_serial": 5436498, "releases": { "1.1.0": [ { "comment_text": "", "digests": { "md5": "7fb4bd04e06d159a5206f95dba99663f", "sha256": "2e11a3c9bbbc5ffce0e581268a7d981db03666f95d6066d9b10a42a9e6aca193" }, "downloads": -1, "filename": "user-agents-next-1.1.0.tar.gz", "has_sig": false, "md5_digest": "7fb4bd04e06d159a5206f95dba99663f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11241, "upload_time": "2019-03-19T14:00:15", "url": "https://files.pythonhosted.org/packages/d4/de/14fb9be69431c47de241bd89b111bf8937f3667f5fc3bb836eea88e80739/user-agents-next-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "f898cf58c982d615cc4eafcf151efe04", "sha256": "c7bca4513ba7c6cc185bedbef895e8471183c064cbd4fbbd9b1abb5a1365f30a" }, "downloads": -1, "filename": "user-agents-next-1.1.1.tar.gz", "has_sig": false, "md5_digest": "f898cf58c982d615cc4eafcf151efe04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11595, "upload_time": "2019-03-20T10:04:08", "url": "https://files.pythonhosted.org/packages/c3/0d/ccaf5f57f2e74625336338729d14191adf95ddd620e9de77061305aa7cf7/user-agents-next-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "416644ad6e381e82b1886a98cd5f28ca", "sha256": "fe84eb80f843a7c113943bfcbc54b8ffbd545198baa9db5faf7a9a0593f9e16d" }, "downloads": -1, "filename": "user-agents-next-1.1.2.tar.gz", "has_sig": false, "md5_digest": "416644ad6e381e82b1886a98cd5f28ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11064, "upload_time": "2019-04-21T05:37:01", "url": "https://files.pythonhosted.org/packages/d3/10/7115c8d9ebf11ba476490ca44878f5c05b5fac15d109432d574de554390f/user-agents-next-1.1.2.tar.gz" } ], "1.1.3": [ { "comment_text": "", "digests": { "md5": "70364495013a564d74959319156242d3", "sha256": "e165dce37fe760f1e7f0f975a45780fea36932f5612720baa42a693a9f7372d4" }, "downloads": -1, "filename": "user-agents-next-1.1.3.tar.gz", "has_sig": false, "md5_digest": "70364495013a564d74959319156242d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11589, "upload_time": "2019-06-23T06:43:57", "url": "https://files.pythonhosted.org/packages/f2/e4/55144fc9170ef525c31127cd2c6bcd695160ef53d20f5f6c309f0ac05e28/user-agents-next-1.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "70364495013a564d74959319156242d3", "sha256": "e165dce37fe760f1e7f0f975a45780fea36932f5612720baa42a693a9f7372d4" }, "downloads": -1, "filename": "user-agents-next-1.1.3.tar.gz", "has_sig": false, "md5_digest": "70364495013a564d74959319156242d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11589, "upload_time": "2019-06-23T06:43:57", "url": "https://files.pythonhosted.org/packages/f2/e4/55144fc9170ef525c31127cd2c6bcd695160ef53d20f5f6c309f0ac05e28/user-agents-next-1.1.3.tar.gz" } ] }