Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.

Commit 5f6d395

Browse files
committed
Update for compatibility with Python 3.6
1 parent 5b5ff80 commit 5f6d395

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

src/UniversalAnalytics/HTTPLog.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import sys
1818

1919
# Third party libraries
20-
from six.moves import cStringIO as StringIO # Used by tests
2120
import six
2221

2322

src/UniversalAnalytics/Tracker.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,9 @@ def debug():
103103
"""
104104
Activate debugging on urllib2.
105105
"""
106-
if six.PY2:
107-
handler = HTTPSHandler(debuglevel=1)
108-
opener = build_opener(handler)
109-
install_opener(opener)
110-
else:
111-
http_client.HTTPConnection.debuglevel = 1
106+
handler = HTTPSHandler(debuglevel=1)
107+
opener = build_opener(handler)
108+
install_opener(opener)
112109

113110
@classmethod
114111
def fixUTF8(cls, data): # Ensure proper encoding for UA's servers...

test/test_everything.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import unittest
1717

1818
# Third party imports
19+
from six.moves import cStringIO as StringIO
1920
from six.moves import urllib
2021

2122
# Local imports
@@ -26,7 +27,7 @@
2627
class UAMPythonTestCase(unittest.TestCase):
2728

2829
def setUp(self):
29-
self._buffer = HTTPLog.StringIO()
30+
self._buffer = StringIO()
3031
# Capture HTTP output in readible fashion
3132
HTTPLog.consume(self._buffer)
3233
Tracker.HTTPPost.debug() # Enabled debugging from urllib2

0 commit comments

Comments
 (0)