Skip to content

Commit 9491ddb

Browse files
committed
Version bump and documentation update
1 parent a6ca5f8 commit 9491ddb

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

‎README.rst‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ and `os` attributes. For example:
5858
user_agent.device # returns Device(family='iPhone')
5959
user_agent.device.family # returns 'iPhone'
6060
61+
# Viewing a pretty string version
62+
str(user_agent) # returns "iPhone / iOS 5.1 / Mobile Safari 5.1"
63+
6164
6265
``user_agents`` also expose a few other more "sophisticated" attributes that are derived from one or
6366
more basic attributes defined above. As for now, these attributes should correctly identify
@@ -86,6 +89,7 @@ For example:
8689
user_agent.is_touch_capable # returns False
8790
user_agent.is_pc # returns False
8891
user_agent.is_bot # returns False
92+
str(user_agent) # returns "BlackBerry 9700 / BlackBerry OS 5 / BlackBerry 9700"
8993
9094
# Now a Samsung Galaxy S3
9195
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'
@@ -95,6 +99,7 @@ For example:
9599
user_agent.is_touch_capable # returns True
96100
user_agent.is_pc # returns False
97101
user_agent.is_bot # returns False
102+
str(user_agent) # returns "GT-I9300 / Android 4.0.4 / Android 4.0.4"
98103
99104
# iPad's user agent string
100105
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'
@@ -104,6 +109,7 @@ For example:
104109
user_agent.is_touch_capable # returns True
105110
user_agent.is_pc # returns False
106111
user_agent.is_bot # returns False
112+
str(user_agent) # returns "iPad / iOS 3.2 / Mobile Safari 4.0.4"
107113
108114
# Kindle Fire's user agent string
109115
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'
@@ -113,6 +119,7 @@ For example:
113119
user_agent.is_touch_capable # returns True
114120
user_agent.is_pc # returns False
115121
user_agent.is_bot # returns False
122+
str(user_agent) # returns "Kindle Fire / Android / Amazon Silk 1.1.0-80"
116123
117124
# Touch capable Windows 8 device
118125
ua_string = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; Touch)'
@@ -122,6 +129,7 @@ For example:
122129
user_agent.is_touch_capable # returns True
123130
user_agent.is_pc # returns True
124131
user_agent.is_bot # returns False
132+
str(user_agent) # returns "PC / Windows 8 / IE 10"
125133
126134
127135
Running Tests
@@ -133,6 +141,10 @@ Running Tests
133141
Changelog
134142
=========
135143

144+
Version 0.3.0
145+
-------------
146+
* Added __str__ method for convenience of pretty string
147+
136148
Version 0.2.0
137149
-------------
138150
* Fixed errors when running against newer versions if ua-parser

‎user_agents/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
VERSION = (0, 2, 0)
1+
VERSION = (0, 3, 0)
22

33
from .parsers import parse

0 commit comments

Comments
 (0)