Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-user-agents for openSUSE:Factory checked in at 2023-07-13 17:18:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-user-agents (Old) and /work/SRC/openSUSE:Factory/.python-user-agents.new.8922 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-user-agents" Thu Jul 13 17:18:35 2023 rev:6 rq:1098455 version:2.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-user-agents/python-user-agents.changes 2020-03-10 15:03:21.257115634 +0100 +++ /work/SRC/openSUSE:Factory/.python-user-agents.new.8922/python-user-agents.changes 2023-07-13 17:18:36.993141368 +0200 @@ -1,0 +2,10 @@ +Thu Jul 13 05:53:34 UTC 2023 - Steve Kowalik <steven.kowa...@suse.com> + +- Update to 2.2.0: + * ua-parser >= 0.10.0 is required. + * Added get_device(), get_os() and get_browser() instance methods + to UserAgent. +- Stop using greedy globs in %files. +- Switch to pyproject and more recent testing macros. + +------------------------------------------------------------------- Old: ---- v2.1.0.tar.gz New: ---- v2.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-user-agents.spec ++++++ --- /var/tmp/diff_new_pack.zA23eb/_old 2023-07-13 17:18:37.781146018 +0200 +++ /var/tmp/diff_new_pack.zA23eb/_new 2023-07-13 17:18:37.785146041 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-user-agents # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,21 +16,20 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-user-agents -Version: 2.1.0 +Version: 2.2.0 Release: 0 Summary: A library to identify device capabilities (phones, tablets) License: MIT URL: https://github.com/selwin/python-user-agents Source: https://github.com/selwin/python-user-agents/archive/v%{version}.tar.gz -BuildRequires: %{python_module PyYAML} +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module ua-parser >= 0.8.0} +BuildRequires: %{python_module ua-parser >= 0.10.0} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-PyYAML -Requires: python-ua-parser >= 0.8.0 +Requires: python-ua-parser >= 0.10.0 BuildArch: noarch %python_subpackages @@ -43,18 +42,19 @@ %setup -q %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}/%{$python_sitelib} %check -%python_expand $python -m unittest discover +%pyunittest %files %{python_files} %license LICENSE.txt -%doc README.rst -%{python_sitelib}/* +%doc README.md +%{python_sitelib}/user_agents +%{python_sitelib}/user_agents-%{version}.dist-info %changelog ++++++ v2.1.0.tar.gz -> v2.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-user-agents-2.1.0/README.md new/python-user-agents-2.2.0/README.md --- old/python-user-agents-2.1.0/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/python-user-agents-2.2.0/README.md 2020-08-23 08:00:01.000000000 +0200 @@ -0,0 +1,179 @@ +Python User Agents +================== + +`user_agents` is a Python library that provides an easy way to identify/detect devices like mobile phones, tablets and their capabilities by parsing (browser/HTTP) user agent strings. The goal is to reliably detect whether: + +* User agent is a mobile, tablet or PC based device +* User agent has touch capabilities (has touch screen) + +`user_agents` relies on the excellent [ua-parser](https://github.com/ua-parser/uap-python) to do the actual parsing of the raw user agent string. + +Installation +------------ + + + +`user-agents` is hosted on [PyPI](http://pypi.python.org/pypi/user-agents/) and can be installed as such: + + pip install pyyaml ua-parser user-agents + +Alternatively, you can also get the latest source code from [Github](https://github.com/selwin/python-user-agents) and install it manually. + +Usage +----- + +Various basic information that can help you identify visitors can be accessed `browser`, `device` and `os` attributes. For example: + +```python +from user_agents import parse + +# iPhone's user agent string +ua_string = 'Mozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B179 Safari/7534.48.3' +user_agent = parse(ua_string) + +# Accessing user agent's browser attributes +user_agent.browser # returns Browser(family=u'Mobile Safari', version=(5, 1), version_string='5.1') +user_agent.browser.family # returns 'Mobile Safari' +user_agent.browser.version # returns (5, 1) +user_agent.browser.version_string # returns '5.1' + +# Accessing user agent's operating system properties +user_agent.os # returns OperatingSystem(family=u'iOS', version=(5, 1), version_string='5.1') +user_agent.os.family # returns 'iOS' +user_agent.os.version # returns (5, 1) +user_agent.os.version_string # returns '5.1' + +# Accessing user agent's device properties +user_agent.device # returns Device(family=u'iPhone', brand=u'Apple', model=u'iPhone') +user_agent.device.family # returns 'iPhone' +user_agent.device.brand # returns 'Apple' +user_agent.device.model # returns 'iPhone' + +# Viewing a pretty string version +str(user_agent) # returns "iPhone / iOS 5.1 / Mobile Safari 5.1" +``` + +`user_agents` also expose a few other more "sophisticated" attributes that are derived from one or more basic attributes defined above. As for now, these attributes should correctly identify popular platforms/devices, pull requests to support smaller ones are always welcome. + +Currently these attributes are supported: + +* `is_mobile`: whether user agent is identified as a mobile phone (iPhone, Android phones, Blackberry, Windows Phone devices etc) +* `is_tablet`: whether user agent is identified as a tablet device (iPad, Kindle Fire, Nexus 7 etc) +* `is_pc`: whether user agent is identified to be running a traditional "desktop" OS (Windows, OS X, Linux) +* `is_touch_capable`: whether user agent has touch capabilities +* `is_bot`: whether user agent is a search engine crawler/spider + +For example: + +```python +from user_agents import parse + +# Let's start from an old, non touch Blackberry device +ua_string = 'BlackBerry9700/5.0.0.862 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/331 UNTRUSTED/1.0 3gpp-gba' +user_agent = parse(ua_string) +user_agent.is_mobile # returns True +user_agent.is_tablet # returns False +user_agent.is_touch_capable # returns False +user_agent.is_pc # returns False +user_agent.is_bot # returns False +str(user_agent) # returns "BlackBerry 9700 / BlackBerry OS 5 / BlackBerry 9700" + +# Now a Samsung Galaxy S3 +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' +user_agent = parse(ua_string) +user_agent.is_mobile # returns True +user_agent.is_tablet # returns False +user_agent.is_touch_capable # returns True +user_agent.is_pc # returns False +user_agent.is_bot # returns False +str(user_agent) # returns "Samsung GT-I9300 / Android 4.0.4 / Android 4.0.4" + +# iPad's user agent string +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' +user_agent = parse(ua_string) +user_agent.is_mobile # returns False +user_agent.is_tablet # returns True +user_agent.is_touch_capable # returns True +user_agent.is_pc # returns False +user_agent.is_bot # returns False +str(user_agent) # returns "iPad / iOS 3.2 / Mobile Safari 4.0.4" + +# Kindle Fire's user agent string +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' +user_agent = parse(ua_string) +user_agent.is_mobile # returns False +user_agent.is_tablet # returns True +user_agent.is_touch_capable # returns True +user_agent.is_pc # returns False +user_agent.is_bot # returns False +str(user_agent) # returns "Kindle / Android / Amazon Silk 1.1.0-80" + +# Touch capable Windows 8 device +ua_string = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; Touch)' +user_agent = parse(ua_string) +user_agent.is_mobile # returns False +user_agent.is_tablet # returns False +user_agent.is_touch_capable # returns True +user_agent.is_pc # returns True +user_agent.is_bot # returns False +str(user_agent) # returns "PC / Windows 8 / IE 10" +``` + +Running Tests +------------- + + python -m unittest discover + +Changelog +--------- +### Version 2.2.0 (2020-08-23) +* `ua-parser` >= 0.10.0 is required. Thanks @jnozsc! +* Added `get_device()`, `get_os()` and `get_browser()` instance methods +to `UserAgent`. Thanks @rodrigondec! + +### Version 2.1 (2020-02-08) + +* `python-user-agents` now require `ua-parser>=0.9.0`. Thanks @jnozsc! +* Properly detect Chrome Mobile browser families. Thanks @jnozsc! + +### Version 2.0 (2019-04-07) + +* `python-user-agents` now require `ua-parser>=0.8.0`. Thanks @IMDagger! + +### Version 1.1 + +* Fixes packaging issue + +### Version 1.0 + +* Adds compatibility with `ua-parser` 0.4.0 +* Access to more device information in `user_agent.device.brand` and `user_agent.device.model` + +### Version 0.3.2 + +* Better mobile detection +* Better PC detection + +### Version 0.3.1 + +* user\_agent.is\_mobile returns True when mobile spider is detected + +### Version 0.3.0 + +* Added **str**/**unicode** methods for convenience of pretty string + +### Version 0.2.0 + +* Fixed errors when running against newer versions if ua-parser +* Support for Python 3 + +### Version 0.1.1 + +* Added `is_bot` property +* Symbian OS devices are now detected as a mobile device + +### Version 0.1 + +* Initial release + +Developed by the cool guys at [Stamps](http://stamps.co.id). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-user-agents-2.1.0/README.rst new/python-user-agents-2.2.0/README.rst --- old/python-user-agents-2.1.0/README.rst 2020-02-08 02:53:42.000000000 +0100 +++ new/python-user-agents-2.2.0/README.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,215 +0,0 @@ -Python User Agents -================== - -``user_agents`` is a Python library that provides an easy way to -identify/detect devices like mobile phones, tablets and their -capabilities by parsing (browser/HTTP) user agent strings. The goal is -to reliably detect whether: - -- User agent is a mobile, tablet or PC based device -- User agent has touch capabilities (has touch screen) - -``user_agents`` relies on the excellent -`ua-parser <https://github.com/ua-parser/uap-python>`_ to do the actual -parsing of the raw user agent string. - -Installation ------------- - -.. figure:: https://secure.travis-ci.org/selwin/python-user-agents.png - :alt: Build status - - Build status - -``user-agents`` is hosted on -`PyPI <http://pypi.python.org/pypi/user-agents/>`__ and can be installed -as such: - -:: - - pip install pyyaml ua-parser user-agents - -Alternatively, you can also get the latest source code from -Github_ and install it manually. - -.. _Github: https://github.com/selwin/python-user-agents - -Usage ------ - -Various basic information that can help you identify visitors can be -accessed ``browser``, ``device`` and ``os`` attributes. For example: - -.. code:: python - - - from user_agents import parse - - # iPhone's user agent string - ua_string = 'Mozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B179 Safari/7534.48.3' - user_agent = parse(ua_string) - - # Accessing user agent's browser attributes - user_agent.browser # returns Browser(family=u'Mobile Safari', version=(5, 1), version_string='5.1') - user_agent.browser.family # returns 'Mobile Safari' - user_agent.browser.version # returns (5, 1) - user_agent.browser.version_string # returns '5.1' - - # Accessing user agent's operating system properties - user_agent.os # returns OperatingSystem(family=u'iOS', version=(5, 1), version_string='5.1') - user_agent.os.family # returns 'iOS' - user_agent.os.version # returns (5, 1) - user_agent.os.version_string # returns '5.1' - - # Accessing user agent's device properties - user_agent.device # returns Device(family=u'iPhone', brand=u'Apple', model=u'iPhone') - user_agent.device.family # returns 'iPhone' - user_agent.device.brand # returns 'Apple' - user_agent.device.model # returns 'iPhone' - - # Viewing a pretty string version - str(user_agent) # returns "iPhone / iOS 5.1 / Mobile Safari 5.1" - -``user_agents`` also expose a few other more "sophisticated" attributes -that are derived from one or more basic attributes defined above. As for -now, these attributes should correctly identify popular -platforms/devices, pull requests to support smaller ones are always -welcome. - -Currently these attributes are supported: - -- ``is_mobile``: whether user agent is identified as a mobile phone - (iPhone, Android phones, Blackberry, Windows Phone devices etc) -- ``is_tablet``: whether user agent is identified as a tablet device - (iPad, Kindle Fire, Nexus 7 etc) -- ``is_pc``: whether user agent is identified to be running a - traditional "desktop" OS (Windows, OS X, Linux) -- ``is_touch_capable``: whether user agent has touch capabilities -- ``is_bot``: whether user agent is a search engine crawler/spider - -For example: - -.. code:: python - - - from user_agents import parse - - # Let's start from an old, non touch Blackberry device - ua_string = 'BlackBerry9700/5.0.0.862 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/331 UNTRUSTED/1.0 3gpp-gba' - user_agent = parse(ua_string) - user_agent.is_mobile # returns True - user_agent.is_tablet # returns False - user_agent.is_touch_capable # returns False - user_agent.is_pc # returns False - user_agent.is_bot # returns False - str(user_agent) # returns "BlackBerry 9700 / BlackBerry OS 5 / BlackBerry 9700" - - # Now a Samsung Galaxy S3 - 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' - user_agent = parse(ua_string) - user_agent.is_mobile # returns True - user_agent.is_tablet # returns False - user_agent.is_touch_capable # returns True - user_agent.is_pc # returns False - user_agent.is_bot # returns False - str(user_agent) # returns "Samsung GT-I9300 / Android 4.0.4 / Android 4.0.4" - - # iPad's user agent string - 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' - user_agent = parse(ua_string) - user_agent.is_mobile # returns False - user_agent.is_tablet # returns True - user_agent.is_touch_capable # returns True - user_agent.is_pc # returns False - user_agent.is_bot # returns False - str(user_agent) # returns "iPad / iOS 3.2 / Mobile Safari 4.0.4" - - # Kindle Fire's user agent string - 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' - user_agent = parse(ua_string) - user_agent.is_mobile # returns False - user_agent.is_tablet # returns True - user_agent.is_touch_capable # returns True - user_agent.is_pc # returns False - user_agent.is_bot # returns False - str(user_agent) # returns "Kindle / Android / Amazon Silk 1.1.0-80" - - # Touch capable Windows 8 device - ua_string = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; Touch)' - user_agent = parse(ua_string) - user_agent.is_mobile # returns False - user_agent.is_tablet # returns False - user_agent.is_touch_capable # returns True - user_agent.is_pc # returns True - user_agent.is_bot # returns False - str(user_agent) # returns "PC / Windows 8 / IE 10" - -Running Tests -------------- - -:: - - python -m unittest discover - -Changelog ---------- - -Version 2.1 (2020-02-08) -~~~~~~~~~~~~~~~~~~~~~~~~ - -- ``python-user-agents`` now require ``ua-parser>=0.9.0``. Thanks @jnozsc! -- Properly detect Chrome Mobile browser families. Thanks @jnozsc! - - -Version 2.0 (2019-04-07) -~~~~~~~~~~~~~~~~~~~~~~~~ - -- ``python-user-agents`` now require ``ua-parser>=0.8.0``. Thanks @IMDagger! - -Version 1.1 -~~~~~~~~~~~~~ - -- Fixes packaging issue - -Version 1.0 -~~~~~~~~~~~ - -- Adds compatibility with ``ua-parser`` 0.4.0 -- Access to more device information in ``user_agent.device.brand`` and - ``user_agent.device.model`` - - -Version 0.3.2 -~~~~~~~~~~~~~ - -- Better mobile detection -- Better PC detection - -Version 0.3.1 -~~~~~~~~~~~~~ - -- user\_agent.is\_mobile returns True when mobile spider is detected - -Version 0.3.0 -~~~~~~~~~~~~~ - -- Added **str**/**unicode** methods for convenience of pretty string - -Version 0.2.0 -~~~~~~~~~~~~~ - -- Fixed errors when running against newer versions if ua-parser -- Support for Python 3 - -Version 0.1.1 -~~~~~~~~~~~~~ - -- Added ``is_bot`` property -- Symbian OS devices are now detected as a mobile device - -Version 0.1 -~~~~~~~~~~~ - -- Initial release - -Developed by the cool guys at `Stamps <http://stamps.co.id>`__. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-user-agents-2.1.0/requirements.txt new/python-user-agents-2.2.0/requirements.txt --- old/python-user-agents-2.1.0/requirements.txt 2020-02-08 02:53:42.000000000 +0100 +++ new/python-user-agents-2.2.0/requirements.txt 2020-08-23 08:00:01.000000000 +0200 @@ -1,3 +1,3 @@ -ua-parser==0.9.0 +ua-parser==0.10.0 PyYAML==5.3; python_version != '3.4' PyYAML==5.2; python_version == '3.4' # the last version support py34 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-user-agents-2.1.0/setup.py new/python-user-agents-2.2.0/setup.py --- old/python-user-agents-2.1.0/setup.py 2020-02-08 02:53:42.000000000 +0100 +++ new/python-user-agents-2.2.0/setup.py 2020-08-23 08:00:01.000000000 +0200 @@ -3,18 +3,19 @@ setup( name='user-agents', - version='2.1', + version='2.2.0', author='Selwin Ong', author_email='selwin....@gmail.com', packages=['user_agents'], url='https://github.com/selwin/python-user-agents', license='MIT', - description='A library to identify devices (phones, tablets) and their capabilities by parsing (browser/HTTP) user agent strings', - long_description=open('README.rst').read(), + description='A library to identify devices (phones, tablets) and their capabilities by parsing browser user agent strings.', + long_description=open('README.md').read(), + long_description_content_type='text/markdown', zip_safe=False, include_package_data=True, package_data={'': ['README.rst']}, - install_requires=['ua-parser>=0.9.0'], + install_requires=['ua-parser>=0.10.0'], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-user-agents-2.1.0/user_agents/__init__.py new/python-user-agents-2.2.0/user_agents/__init__.py --- old/python-user-agents-2.1.0/user_agents/__init__.py 2020-02-08 02:53:42.000000000 +0100 +++ new/python-user-agents-2.2.0/user_agents/__init__.py 2020-08-23 08:00:01.000000000 +0200 @@ -1,3 +1,3 @@ -VERSION = (2, 1, 0) +VERSION = (2, 2, 0) from .parsers import parse diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-user-agents-2.1.0/user_agents/parsers.py new/python-user-agents-2.2.0/user_agents/parsers.py --- old/python-user-agents-2.1.0/user_agents/parsers.py 2020-02-08 02:53:42.000000000 +0100 +++ new/python-user-agents-2.2.0/user_agents/parsers.py 2020-08-23 08:00:01.000000000 +0200 @@ -140,10 +140,11 @@ self.device = parse_device(**ua_dict['device']) def __str__(self): - device = self.is_pc and "PC" or self.device.family - os = ("%s %s" % (self.os.family, self.os.version_string)).strip() - browser = ("%s %s" % (self.browser.family, self.browser.version_string)).strip() - return " / ".join([device, os, browser]) + return "{device} / {os} / {browser}".format( + device=self.get_device(), + os=self.get_os(), + browser=self.get_browser() + ) def __unicode__(self): return unicode(str(self)) @@ -163,10 +164,17 @@ return True if 'Blackberry 95' in self.device.family: # BB Storm devices return True - if 'Blackberry 95' in self.device.family: # BB Torch devices - return True return False + def get_device(self): + return self.is_pc and "PC" or self.device.family + + def get_os(self): + return ("%s %s" % (self.os.family, self.os.version_string)).strip() + + def get_browser(self): + return ("%s %s" % (self.browser.family, self.browser.version_string)).strip() + @property def is_tablet(self): if self.device.family in TABLET_DEVICE_FAMILIES: @@ -255,5 +263,6 @@ return True return False + def parse(user_agent_string): return UserAgent(user_agent_string)