From 5a2c3d089aef5525421f4ecdd2973cdd921613cd Mon Sep 17 00:00:00 2001 From: Philip Jenvey Date: Fri, 13 Jul 2018 13:50:27 -0700 Subject: [PATCH] feat: update dependencies also fix missing ua_os/browser_ver fields in the session stats Closes #1270 --- autopush/tests/test_integration.py | 9 ++++- autopush/tests/test_utils.py | 2 +- autopush/websocket.py | 2 ++ requirements.in | 1 - requirements.txt | 55 +++++++++++++++--------------- 5 files changed, 39 insertions(+), 30 deletions(-) diff --git a/autopush/tests/test_integration.py b/autopush/tests/test_integration.py index 87628d80..e89b2a74 100644 --- a/autopush/tests/test_integration.py +++ b/autopush/tests/test_integration.py @@ -88,6 +88,11 @@ def __init__(self, url, sslcontext=None): keyid="http://example.org/bob/keys/123;salt="XZwpw6o37R-6qoZjw6KwAw"\ """ self.sslcontext = sslcontext + self.headers = { + "User-Agent": + "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) " + "Gecko/20100101 Firefox/61.0" + } def __getattribute__(self, name): # Python fun to turn all functions into deferToThread functions @@ -104,7 +109,7 @@ def connect(self, connection_port=None): url = self.url if connection_port: # pragma: nocover url = "ws://localhost:{}/".format(connection_port) - self.ws = websocket.create_connection(url) + self.ws = websocket.create_connection(url, header=self.headers) return self.ws.connected def hello(self, uaid=None, services=None): @@ -677,6 +682,8 @@ def test_basic_delivery(self): log_event = self.logs.logged_session() assert log_event["connection_type"] == "webpush" assert log_event["direct_storage"] == 1 + assert log_event["ua_os_ver"] == "10.13" + assert log_event["ua_browser_ver"] == "61.0" @inlineCallbacks def test_topic_basic_delivery(self): diff --git a/autopush/tests/test_utils.py b/autopush/tests/test_utils.py index fbaf4e61..c12d5a39 100644 --- a/autopush/tests/test_utils.py +++ b/autopush/tests/test_utils.py @@ -18,7 +18,7 @@ def test_linux_extraction(self): def test_windows_extraction(self): dd, raw = self._makeFUT('Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)') # NOQA assert dd["ua_os_family"] == "Windows" - assert raw["ua_os_family"] == "Windows 7" + assert raw["ua_os_family"] == "Windows" def test_valid_os(self): dd, raw = self._makeFUT('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:2.1.1) Gecko/ Firefox/5.0.1') # NOQA diff --git a/autopush/websocket.py b/autopush/websocket.py index 36f3ec18..acbe9137 100644 --- a/autopush/websocket.py +++ b/autopush/websocket.py @@ -236,6 +236,8 @@ def __attrs_post_init__(self): for tag_name, tag_value in dd_tags.items(): setattr(self.stats, tag_name, tag_value) self._base_tags.append("%s:%s" % (tag_name, tag_value)) + self.stats.ua_os_ver = self.raw_agent["ua_os_ver"] + self.stats.ua_browser_ver = self.raw_agent["ua_browser_ver"] if self.stats.host: self._base_tags.append("host:%s" % self.stats.host) diff --git a/requirements.in b/requirements.in index 8f3fd433..bb16d20c 100644 --- a/requirements.in +++ b/requirements.in @@ -21,7 +21,6 @@ raven requests service-identity simplejson --e git+https://github.com/mitsuhiko/snaek.git@2b14b8b010a9486af0f298b4ad4c73dc1ceff9d6#egg=snaek twisted -e git+https://github.com/habnabit/txstatsd.git@157ef85fbdeafe23865c7c4e176237ffcb3c3f1f#egg=txStatsD-master typing diff --git a/requirements.txt b/requirements.txt index 6995e113..b6aeffce 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,12 +1,12 @@ -e git+https://github.com/habnabit/txstatsd.git@157ef85fbdeafe23865c7c4e176237ffcb3c3f1f#egg=txStatsD-master apns==2.0.1 asn1crypto==0.24.0 # via cryptography -attrs==17.4.0 -autobahn[twisted]==18.3.1 -automat==0.6.0 # via twisted -boto3==1.7.0 -botocore==1.10.0 # via boto3, s3transfer -certifi==2018.1.18 # via requests +attrs==18.1.0 +autobahn[twisted]==18.6.1 +automat==0.7.0 # via twisted +boto3==1.7.57 +botocore==1.10.57 # via boto3, s3transfer +certifi==2018.4.16 # via requests cffi==1.11.5 chardet==3.0.4 # via requests click==6.7 @@ -15,46 +15,47 @@ constantly==15.1.0 # via twisted contextlib2==0.5.5 # via raven cryptography==2.2.2 cyclone==1.1 -datadog==0.20.0 -decorator==4.2.1 # via datadog +datadog==0.22.0 +decorator==4.3.0 # via datadog docutils==0.14 # via botocore ecdsa==0.13 # via python-jose enum34==1.1.6 # via cryptography, h2 future==0.16.0 # via python-jose futures==3.2.0 # via s3transfer gcm-client==0.1.4 -graphviz==0.8.2 # via objgraph +graphviz==0.8.4 # via objgraph h2==2.6.2 # via hyper hpack==3.0.0 # via h2 hyper==0.7.0 hyperframe==3.2.0 # via h2, hyper hyperlink==18.0.0 # via twisted -idna==2.6 # via cryptography, hyperlink, requests +idna==2.7 # via cryptography, hyperlink, requests incremental==17.5.0 # via twisted -ipaddress==1.0.19 # via cryptography +ipaddress==1.0.22 # via cryptography jmespath==0.9.3 # via boto3, botocore marshmallow-polyfield==3.2 -marshmallow==2.15.0 +marshmallow==2.15.3 objgraph==3.4.0 -pyasn1-modules==0.2.1 # via service-identity -pyasn1==0.4.2 +pyasn1-modules==0.2.2 # via service-identity +pyasn1==0.4.3 pycparser==2.18 # via cffi -pycryptodome==3.5.1 # via python-jose pyfcm==1.4.5 -pyopenssl==17.5.0 -python-dateutil==2.6.1 # via botocore -python-jose==2.0.2 -raven==6.6.0 +pyhamcrest==1.9.0 # via twisted +pyopenssl==18.0.0 +python-dateutil==2.7.3 # via botocore +python-jose==3.0.0 +raven==6.9.0 requests-toolbelt==0.8.0 # via pyfcm -requests==2.18.4 +requests==2.19.1 +rsa==3.4.2 # via python-jose s3transfer==0.1.13 # via boto3 service-identity==17.0.0 -simplejson==3.13.2 -six==1.11.0 # via autobahn, automat, cryptography, pyopenssl, python-dateutil, python-jose, txaio -twisted==17.9.0 -txaio==2.9.0 # via autobahn +simplejson==3.16.0 +six==1.11.0 # via autobahn, automat, cryptography, pyhamcrest, pyopenssl, python-dateutil, python-jose, txaio +twisted==18.7.0 +txaio==2.10.0 # via autobahn typing==3.6.4 -ua-parser==0.7.3 -urllib3==1.22 # via requests +ua-parser==0.8.0 +urllib3==1.23 # via requests wsaccel==0.6.2 ; platform_python_implementation == "CPython" -zope.interface==4.4.3 +zope.interface==4.5.0