encode request data if it is in unicode/str type

This commit is contained in:
debugtalk
2018-03-26 00:05:06 +08:00
parent 01dda7b92d
commit da6c0cb848
5 changed files with 24 additions and 40 deletions

View File

@@ -196,13 +196,13 @@ def get_imported_module(module_name):
def get_imported_module_from_file(file_path):
""" import module from python file path and return imported module
"""
if is_py3:
imported_module = importlib.machinery.SourceFileLoader(
'module_name', file_path).load_module()
else:
# Python 2.7
elif is_py2:
imported_module = imp.load_source('module_name', file_path)
else:
raise RuntimeError("Neither Python 3 nor Python 2.")
return imported_module