1
1
Python User Agents
2
2
==================
3
3
4
- `user_agents ` is a Python library that provides an easy way to identify devices like mobile phones,
4
+ `` user_agents ` ` is a Python library that provides an easy way to identify devices like mobile phones,
5
5
tablets and their capabilities by parsing (browser) user agent strings. The goal is to reliably
6
6
detect whether:
7
7
8
8
* User agent is a mobile, tablet or PC based device
9
9
* User agent has touch capabilities (has touch screen)
10
10
11
- `user_agents ` relies on the excellent `ua-parser <https://github.com/tobie/ua-parser >`_ to do the
11
+ `` user_agents ` ` relies on the excellent `ua-parser <https://github.com/tobie/ua-parser >`_ to do the
12
12
actual parsing of the raw user agent string.
13
13
14
14
This library should be considered "alpha". Please post feature suggestions, bug or pull requests to
@@ -18,7 +18,10 @@ identify more devices on Github.
18
18
Installation
19
19
============
20
20
21
- WARNING: This library should be considered "alpha". Use this in production at your own risk.
21
+ WARNING: This library should be considered "alpha". Use this in production at your own risk.
22
+ ``user-agents `` is hosted on `PyPI <http://pypi.python.org/pypi/user-agents/ >`_ and can be installed as such::
23
+
24
+ pip install pyyaml ua-parser user-agents
22
25
23
26
Usage
24
27
=====
@@ -50,16 +53,16 @@ and `os` attributes. For example:
50
53
user_agent.device.family # returns 'iPhone'
51
54
52
55
53
- `user_agents ` also expose a few other more "sophisticated" attributes that are derived from one or
56
+ `` user_agents ` ` also expose a few other more "sophisticated" attributes that are derived from one or
54
57
more basic attributes defined above. As for now, these attributes should correctly identify
55
58
popular platforms/devices, pull requests to support smaller ones are always welcome.
56
59
57
60
Currently these attributes are supported:
58
61
59
- * `is_mobile ` - whether user agent is identified as a mobile phone (iPhone, Android phones, Blackberry, Windows Phone devices etc)
60
- * `is_tablet ` - whether user agent is identified as a tablet device (iPad, Kindle Fire, Nexus 7 etc)
61
- * `is_pc ` - whether user agent is identified to be running a traditional "desktop" OS (Windows, OS X, Linux)
62
- * `is_touch_capable ` - whether user agent has touch capabilities
62
+ * `` is_mobile ``: whether user agent is identified as a mobile phone (iPhone, Android phones, Blackberry, Windows Phone devices etc)
63
+ * `` is_tablet ``: whether user agent is identified as a tablet device (iPad, Kindle Fire, Nexus 7 etc)
64
+ * `` is_pc ``: whether user agent is identified to be running a traditional "desktop" OS (Windows, OS X, Linux)
65
+ * `` is_touch_capable ``: whether user agent has touch capabilities
63
66
64
67
65
68
For example:
0 commit comments