return json.loads(ret.read())
else:
req['command'] = command
req['nonce'] = int(time.time()*1000)
post_data=urllib.parse.urlencode('utf-8')
sign = hmac.new(self.Secret, post_data, hashlib.sha512).hexdigest()
headers = {
("sign"): sign,
("key"): self.APIKey
}
headers = headers.encode('utf-8')
ret = urllib.parse.urlencode('https://poloniex.com/tradingApi', post_data, headers)
ret = urllib.request.urlopen()
jsonRet = json.loads(ret.read())
return self.post_process(jsonRet)
这是连接到poloniex交换以自动执行加密交易的python代码。关于这部分,我遇到了问题。这段代码写在python 2上,然后我尝试将它转换为python 3。