Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2e5111f

Browse filesBrowse files
committed
Version bump and documentation update
1 parent 542a609 commit 2e5111f
Copy full SHA for 2e5111f

File tree

Expand file treeCollapse file tree

2 files changed

+13
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+13
-1
lines changed

‎README.rst

Copy file name to clipboardExpand all lines: README.rst
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ and `os` attributes. For example:
5757
user_agent.device # returns Device(family='iPhone')
5858
user_agent.device.family # returns 'iPhone'
5959
60+
# Viewing a pretty string version
61+
str(user_agent) # returns "iPhone / iOS 5.1 / Mobile Safari 5.1"
62+
6063
6164
``user_agents`` also expose a few other more "sophisticated" attributes that are derived from one or
6265
more basic attributes defined above. As for now, these attributes should correctly identify
@@ -85,6 +88,7 @@ For example:
8588
user_agent.is_touch_capable # returns False
8689
user_agent.is_pc # returns False
8790
user_agent.is_bot # returns False
91+
str(user_agent) # returns "BlackBerry 9700 / BlackBerry OS 5 / BlackBerry 9700"
8892
8993
# Now a Samsung Galaxy S3
9094
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'
@@ -94,6 +98,7 @@ For example:
9498
user_agent.is_touch_capable # returns True
9599
user_agent.is_pc # returns False
96100
user_agent.is_bot # returns False
101+
str(user_agent) # returns "GT-I9300 / Android 4.0.4 / Android 4.0.4"
97102
98103
# iPad's user agent string
99104
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'
@@ -103,6 +108,7 @@ For example:
103108
user_agent.is_touch_capable # returns True
104109
user_agent.is_pc # returns False
105110
user_agent.is_bot # returns False
111+
str(user_agent) # returns "iPad / iOS 3.2 / Mobile Safari 4.0.4"
106112
107113
# Kindle Fire's user agent string
108114
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'
@@ -112,6 +118,7 @@ For example:
112118
user_agent.is_touch_capable # returns True
113119
user_agent.is_pc # returns False
114120
user_agent.is_bot # returns False
121+
str(user_agent) # returns "Kindle Fire / Android / Amazon Silk 1.1.0-80"
115122
116123
# Touch capable Windows 8 device
117124
ua_string = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; Touch)'
@@ -121,6 +128,7 @@ For example:
121128
user_agent.is_touch_capable # returns True
122129
user_agent.is_pc # returns True
123130
user_agent.is_bot # returns False
131+
str(user_agent) # returns "PC / Windows 8 / IE 10"
124132
125133
126134
Running Tests
@@ -132,6 +140,10 @@ Running Tests
132140
Changelog
133141
=========
134142

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

‎user_agents/__init__.py

Copy file name to clipboard
+1-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.