Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
1Metadata-Version: 2.1
2Name: httpagentparser
3Version: 1.9.5
4Summary: Extracts OS Browser etc information from http user agent string
5Home-page: https://github.com/shon/httpagentparser
6Author: Shekhar Tiwatne
7Author-email: pythonic@gmail.com
8License: http://www.opensource.org/licenses/mit-license.php
9Classifier: Programming Language :: Python :: 3
10License-File: LICENSE.txt
11
12.. image:: http://pepy.tech/badge/httpagentparser
13        :target: http://pepy.tech/project/httpagentparser
14
15.. image:: https://img.shields.io/pypi/v/httpagentparser.svg
16        :target: https://pypi.python.org/pypi/httpagentparser
17
18.. image:: https://img.shields.io/travis/shon/httpagentparser.svg
19        :target: https://travis-ci.org/shon/httpagentparser
20
21
22.. image:: https://img.shields.io/travis/shon/httpagentparser.svg
23        :target: https://travis-ci.org/shon/httpagentparser
24
25Features
26--------
27
28- Fast
29- Detects OS and Browser. Does not aim to be a full featured agent parser
30- Will not turn into django-httpagentparser ;)
31
32Usage
33-----
34
35.. code-block:: python
36
37    >>> import httpagentparser
38    >>> s = "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.9 (KHTML, like Gecko) \
39            Chrome/5.0.307.11 Safari/532.9"
40    >>> print(httpagentparser.simple_detect(s))
41    ('Linux', 'Chrome 5.0.307.11')
42    >>> print(httpagentparser.detect(s))
43    {'os': {'name': 'Linux'},
44     'browser': {'version': '5.0.307.11', 'name': 'Chrome'}}
45
46    >>> s = "Mozilla/5.0 (Linux; U; Android 2.3.5; en-in; HTC_DesireS_S510e Build/GRJ90) \
47            AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
48    >>> print(httpagentparser.simple_detect(s))
49    ('Android Linux 2.3.5', 'Safari 4.0')
50    >>> print(httpagentparser.detect(s))
51    {'dist': {'version': '2.3.5', 'name': 'Android'},
52    'os': {'name': 'Linux'},
53    'browser': {'version': '4.0', 'name': 'Safari'}}
54
55History
56-------
57
58http://stackoverflow.com/questions/927552/parsing-http-user-agent-string/1151956#1151956
59 
codekingpro/portable-devtools · Team Ai