You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
775 B
29 lines
775 B
import os
|
|
import sys
|
|
import base64
|
|
|
|
def add_python_version_specific_paths():
|
|
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib'))
|
|
|
|
if sys.version_info < (3, 0):
|
|
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib/py2'))
|
|
else:
|
|
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib/py3'))
|
|
|
|
|
|
add_python_version_specific_paths()
|
|
|
|
def b64encode_to_str(string):
|
|
"""
|
|
Creates a base 64 encoding. If using python 3, encodes the bytes object as a string
|
|
|
|
|
|
:param string in python 2, byte string in python 3:
|
|
:return: string
|
|
"""
|
|
if sys.version_info < (3, 0):
|
|
return base64.b64encode(string)
|
|
|
|
return base64.b64encode(string).decode('ascii')
|
|
|