QcloudApi / qcloudapi-sdk-python

Tencent Cloud SDK for Python
https://cloud.tencent.com/
Other
182 stars 70 forks source link

单独跑sdk没有问题,集成进django项目出现TypeError: character mapping must return integer, None or unicode #34

Closed pangpeng closed 6 years ago

pangpeng commented 6 years ago

D:\Python\Pyenv27\Scripts\python.exe D:/Workspace/framework/tests/tt.py traceback.format_exc(): Traceback (most recent call last): File "D:/Workspace/framework/tests/tt.py", line 70, in qcloud_manage(account) File "D:/Workspace/framework/tests/tt.py", line 49, in qcloud_manage regions = get_regions(account) File "D:/Workspace/framework/tests/tt.py", line 42, in get_regions regions_res = json.loads(service.call('DescribeRegions', {'offset': 0, 'limit': 100, })) File "D:\Workspace\framework\QcloudApi\qcloudapi.py", line 175, in call return service.call(action, params) File "D:\Workspace\framework\QcloudApi\modules\base.py", line 157, in call self._build_req_inter(action, params, req_inter) File "D:\Workspace\framework\QcloudApi\modules\base.py", line 134, in _build_req_inter req_inter.method, self.sign_method) File "D:\Workspace\framework\QcloudApi\common\sign.py", line 37, in make hashed = hmac.new(self.secretKey, msg, digestmod) File "D:\Python\Python27\Lib\hmac.py", line 136, in new return HMAC(key, msg, digestmod) File "D:\Python\Python27\Lib\hmac.py", line 75, in init self.outer.update(key.translate(trans_5C)) TypeError: character mapping must return integer, None or unicode ![Uploading image.png…]()


111

pangpeng commented 6 years ago

解决了: service = QcloudApi('cvm', {'secretId': str(account.account_id), 'secretKey': str(account.account_key)})