Skip to content

Commit 87d43c2

Browse files
author
nedgibert
authored
Update README.rst
1 parent 2be8e05 commit 87d43c2

File tree

1 file changed

+0
-114
lines changed

1 file changed

+0
-114
lines changed

README.rst

Lines changed: 0 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -5,117 +5,3 @@ Performance has increased by a factor of 10x
55

66
A python implementation of the UA Parser (https://github.com/ua-parser,
77
formerly https://github.com/tobie/ua-parser)
8-
9-
Build Status
10-
------------
11-
12-
.. image:: https://github.com/ua-parser/uap-python/actions/workflows/ci.yml/badge.svg
13-
:alt: CI on the master branch
14-
15-
16-
Installing
17-
----------
18-
19-
Install via pip
20-
~~~~~~~~~~~~~~~
21-
22-
Just run:
23-
24-
.. code-block:: sh
25-
26-
$ pip install ua-parser
27-
28-
Manual install
29-
~~~~~~~~~~~~~~
30-
31-
In the top-level directory run:
32-
33-
.. code-block:: sh
34-
35-
$ python setup.py install
36-
37-
Change Log
38-
---------------
39-
Because this repo is mostly a python wrapper for the User Agent String Parser repo (https://github.com/ua-parser/uap-core), the changes made to this repo are best described by the update diffs in that project. Please see the diffs for this submodule (https://github.com/ua-parser/uap-core/releases) for a list of what has changed between versions of this package.
40-
41-
Getting Started
42-
---------------
43-
44-
Retrieve data on a user-agent string
45-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46-
47-
.. code-block:: python
48-
49-
>>> from ua_parser import user_agent_parser
50-
>>> import pprint
51-
>>> pp = pprint.PrettyPrinter(indent=4)
52-
>>> ua_string = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104 Safari/537.36'
53-
>>> parsed_string = user_agent_parser.Parse(ua_string)
54-
>>> pp.pprint(parsed_string)
55-
{ 'device': {'brand': 'Apple', 'family': 'Mac', 'model': 'Mac'},
56-
'os': { 'family': 'Mac OS X',
57-
'major': '10',
58-
'minor': '9',
59-
'patch': '4',
60-
'patch_minor': None},
61-
'string': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) '
62-
'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104 '
63-
'Safari/537.36',
64-
'user_agent': { 'family': 'Chrome',
65-
'major': '41',
66-
'minor': '0',
67-
'patch': '2272'}}
68-
69-
Extract browser data from user-agent string
70-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71-
72-
.. code-block:: python
73-
74-
>>> from ua_parser import user_agent_parser
75-
>>> import pprint
76-
>>> pp = pprint.PrettyPrinter(indent=4)
77-
>>> ua_string = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104 Safari/537.36'
78-
>>> parsed_string = user_agent_parser.ParseUserAgent(ua_string)
79-
>>> pp.pprint(parsed_string)
80-
{'family': 'Chrome', 'major': '41', 'minor': '0', 'patch': '2272'}
81-
82-
..
83-
84-
⚠️Before 0.15, the convenience parsers (``ParseUserAgent``,
85-
``ParseOs``, and ``ParseDevice``) were not cached, which could
86-
result in degraded performances when parsing large amounts of
87-
identical user-agents (which might occur for real-world datasets).
88-
89-
For these versions (up to 0.10 included), prefer using ``Parse``
90-
and extracting the sub-component you need from the resulting
91-
dictionary.
92-
93-
Extract OS information from user-agent string
94-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95-
96-
.. code-block:: python
97-
98-
>>> from ua_parser import user_agent_parser
99-
>>> import pprint
100-
>>> pp = pprint.PrettyPrinter(indent=4)
101-
>>> ua_string = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104 Safari/537.36'
102-
>>> parsed_string = user_agent_parser.ParseOS(ua_string)
103-
>>> pp.pprint(parsed_string)
104-
{ 'family': 'Mac OS X',
105-
'major': '10',
106-
'minor': '9',
107-
'patch': '4',
108-
'patch_minor': None}
109-
110-
Extract Device information from user-agent string
111-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
112-
113-
.. code-block:: python
114-
115-
>>> from ua_parser import user_agent_parser
116-
>>> import pprint
117-
>>> pp = pprint.PrettyPrinter(indent=4)
118-
>>> ua_string = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104 Safari/537.36'
119-
>>> parsed_string = user_agent_parser.ParseDevice(ua_string)
120-
>>> pp.pprint(parsed_string)
121-
{'brand': 'Apple', 'family': 'Mac', 'model': 'Mac'}

0 commit comments

Comments
 (0)