2 # -*- coding: utf-8 -*-
4 # Created on: 13.01.2017
8 # Takes everything, does nothing, classic no operation function
13 def log(f, name=None):
16 def wrapped(*args, **kwargs):
18 class_name = that.__class__.__name__
20 for key, value in kwargs.iteritems():
21 if key != 'account' and key != 'credentials':
22 arguments += ":%s = %s:" % (key, value)
24 that.log('"' + class_name + '::' + name + '" called with arguments ' + arguments)
26 that.log('"' + class_name + '::' + name + '" called')
27 result = f(*args, **kwargs)
28 that.log('"' + class_name + '::' + name + '" returned: ' + str(result))
30 wrapped.__doc__ = f.__doc__
33 def get_user_agent_for_current_platform():
34 """Determines the user agent string for the current platform (to retrieve a valid ESN)
39 User Agent for platform
41 system = platform.system()
42 if system == 'Darwin':
43 return 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36'
44 if system == 'Windows':
45 return 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36'
46 if platform.machine().startswith('arm'):
47 return 'Mozilla/5.0 (X11; CrOS armv7l 7647.78.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36'
48 return 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36'