Skip to content

Commit

Permalink
Merge pull request CiscoUcs#31 from dsoper2/master
Browse files Browse the repository at this point in the history
pycryptodome support for Python 2 or 3 byte strings
  • Loading branch information
dsoper2 authored Aug 31, 2018
2 parents 2a44a4b + 9f4a217 commit 5f32010
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/device_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,12 @@ def __init__(self, device):
if sys.version_info[0] == 3:
import urllib.parse as URL
import get_data_3 as get_data
import six
password = six.b(self.device['password'])
elif sys.version_info[0] == 2:
import urllib as URL
import get_data_2 as get_data
password = str(self.device['password'])
system_type = platform.system()
utils_extension = ''
if system_type == 'Darwin':
Expand All @@ -191,7 +194,7 @@ def __init__(self, device):
utils_exe = "%s/%s/GetData%s" % (utils_dir, system_type, utils_extension)
try:
passphrase = subprocess.check_output([utils_exe, self.device['username']])
utils_password = get_data.E(passphrase, str(self.device['password']))
utils_password = get_data.E(passphrase, password)
imc_login_str = "user=%s&password=%s" % (URL.quote_plus(self.device['username']), URL.quote_plus(utils_password.rstrip()))
imc_login_uri = "https://%s/data/login" % self.device['hostname']
referer = "https://%s/uiconnector/index.html" % self.device['hostname']
Expand Down

0 comments on commit 5f32010

Please sign in to comment.