mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 13:41:15 -07:00
Patch UniversalAnalytics using six
This commit is contained in:
parent
244a3e5be3
commit
e19938b05e
2 changed files with 11 additions and 7 deletions
|
@ -7,10 +7,14 @@
|
||||||
# assistance in strategy, implementation, or auditing existing work.
|
# assistance in strategy, implementation, or auditing existing work.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
from urllib2 import urlopen, build_opener, install_opener
|
import six
|
||||||
from urllib2 import Request, HTTPSHandler
|
basestring = six.string_types
|
||||||
from urllib2 import URLError, HTTPError
|
unicode = six.text_type
|
||||||
from urllib import urlencode
|
|
||||||
|
from six.moves.urllib.request import urlopen, build_opener, install_opener
|
||||||
|
from six.moves.urllib.request import Request, HTTPSHandler
|
||||||
|
from six.moves.urllib.error import URLError, HTTPError
|
||||||
|
from six.moves.urllib.parse import urlencode
|
||||||
|
|
||||||
import random
|
import random
|
||||||
import datetime
|
import datetime
|
||||||
|
@ -44,7 +48,7 @@ class Time(datetime.datetime):
|
||||||
def to_unix(cls, timestamp):
|
def to_unix(cls, timestamp):
|
||||||
""" Wrapper over time module to produce Unix epoch time as a float """
|
""" Wrapper over time module to produce Unix epoch time as a float """
|
||||||
if not isinstance(timestamp, datetime.datetime):
|
if not isinstance(timestamp, datetime.datetime):
|
||||||
raise TypeError, 'Time.milliseconds expects a datetime object'
|
raise TypeError('Time.milliseconds expects a datetime object')
|
||||||
base = time.mktime(timestamp.timetuple())
|
base = time.mktime(timestamp.timetuple())
|
||||||
return base
|
return base
|
||||||
|
|
||||||
|
@ -150,7 +154,7 @@ class Tracker(object):
|
||||||
typecast, param_name = cls.parameter_alias.get(name)
|
typecast, param_name = cls.parameter_alias.get(name)
|
||||||
return param_name, typecast(value)
|
return param_name, typecast(value)
|
||||||
else:
|
else:
|
||||||
raise KeyError, 'Parameter "{0}" is not recognized'.format(name)
|
raise KeyError('Parameter "{0}" is not recognized'.format(name))
|
||||||
|
|
||||||
def payload(self, data):
|
def payload(self, data):
|
||||||
for key, value in data.iteritems():
|
for key, value in data.iteritems():
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
import Tracker
|
from . import Tracker
|
Loading…
Add table
Add a link
Reference in a new issue