mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 12:59:42 -07:00
Bump httpagentparser from 1.9.1 to 1.9.2 (#1631)
* Bump httpagentparser from 1.9.1 to 1.9.2 Bumps [httpagentparser](https://github.com/shon/httpagentparser) from 1.9.1 to 1.9.2. - [Release notes](https://github.com/shon/httpagentparser/releases) - [Commits](https://github.com/shon/httpagentparser/commits) --- updated-dependencies: - dependency-name: httpagentparser dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Update httpagentparser==1.9.2 Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
2d9e109f97
commit
5523d4ba88
2 changed files with 32 additions and 7 deletions
|
@ -8,7 +8,7 @@ Tries to
|
||||||
* assist python web apps to detect clients.
|
* assist python web apps to detect clients.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = '1.9.1'
|
__version__ = '1.9.2'
|
||||||
|
|
||||||
|
|
||||||
class DetectorsHub(dict):
|
class DetectorsHub(dict):
|
||||||
|
@ -671,11 +671,21 @@ def detect(agent, fill_none=False):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def simple_detect(agent):
|
UNKNOWN_OS_NAME = 'Unknown OS'
|
||||||
|
UNKNOWN_BROWSER_NAME = 'Unknown Browser'
|
||||||
|
|
||||||
|
|
||||||
|
def simple_detect_tuple(agent, parsed_agent=None):
|
||||||
"""
|
"""
|
||||||
-> (os, browser) # tuple of strings
|
@params:
|
||||||
|
agent::str
|
||||||
|
parsed_agent::dict
|
||||||
|
The result of detect, used to save calculations
|
||||||
|
|
||||||
|
@return:
|
||||||
|
(os_name, os_version, browser_name, browser_version)::Tuple(str)
|
||||||
"""
|
"""
|
||||||
result = detect(agent)
|
result = parsed_agent or detect(agent)
|
||||||
os_list = []
|
os_list = []
|
||||||
if 'flavor' in result:
|
if 'flavor' in result:
|
||||||
os_list.append(result['flavor']['name'])
|
os_list.append(result['flavor']['name'])
|
||||||
|
@ -684,11 +694,26 @@ def simple_detect(agent):
|
||||||
if 'os' in result:
|
if 'os' in result:
|
||||||
os_list.append(result['os']['name'])
|
os_list.append(result['os']['name'])
|
||||||
|
|
||||||
os = os_list and " ".join(os_list) or "Unknown OS"
|
os = os_list and " ".join(os_list) or UNKNOWN_OS_NAME
|
||||||
os_version = os_list and (result.get('flavor') and result['flavor'].get('version')) or \
|
os_version = os_list and (result.get('flavor') and result['flavor'].get('version')) or \
|
||||||
(result.get('dist') and result['dist'].get('version')) or (result.get('os') and result['os'].get('version')) or ""
|
(result.get('dist') and result['dist'].get('version')) or (result.get('os') and result['os'].get('version')) or ""
|
||||||
browser = 'browser' in result and result['browser'].get('name') or 'Unknown Browser'
|
browser = 'browser' in result and result['browser'].get('name') or UNKNOWN_BROWSER_NAME
|
||||||
browser_version = 'browser' in result and result['browser'].get('version') or ""
|
browser_version = 'browser' in result and result['browser'].get('version') or ""
|
||||||
|
|
||||||
|
return os, os_version, browser, browser_version
|
||||||
|
|
||||||
|
|
||||||
|
def simple_detect(agent, parsed_agent=None):
|
||||||
|
"""
|
||||||
|
@params:
|
||||||
|
agent::str
|
||||||
|
parsed_agent::dict
|
||||||
|
The result of detect, used to save calculations
|
||||||
|
|
||||||
|
@return:
|
||||||
|
(os_name_version, browser_name_version)::Tuple(str)
|
||||||
|
"""
|
||||||
|
os, os_version, browser, browser_version = simple_detect_tuple(agent, parsed_agent=parsed_agent)
|
||||||
if browser_version:
|
if browser_version:
|
||||||
browser = " ".join((browser, browser_version))
|
browser = " ".join((browser, browser_version))
|
||||||
if os_version:
|
if os_version:
|
||||||
|
|
|
@ -16,7 +16,7 @@ facebook-sdk==3.1.0
|
||||||
future==0.18.2
|
future==0.18.2
|
||||||
gntp==1.0.3
|
gntp==1.0.3
|
||||||
html5lib==1.1
|
html5lib==1.1
|
||||||
httpagentparser==1.9.1
|
httpagentparser==1.9.2
|
||||||
idna==3.3
|
idna==3.3
|
||||||
importlib-resources==5.4.0
|
importlib-resources==5.4.0
|
||||||
git+https://github.com/Tautulli/ipwhois.git@master#egg=ipwhois
|
git+https://github.com/Tautulli/ipwhois.git@master#egg=ipwhois
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue