Skip to content
Merged

S3 #65

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ deploy:
provider: pypi
distributions: sdist bdist_wheel
user: dt3310321
password: *********
password:
secure: LoSq2wZPbXJ4DkYCQk6Oi0mI6iwhAiE6Xgyvl+Rv1geYqPTuI8ht7dps2ENHM2gj8JqhsZ7C5p/g9P6YuIBk0OTYKewHgHBnUAQwePzu0N1ofzJtJVoSbhW0aPeNfF6DxkTPscBGCHuMyHb/r/buHa3hLoJKxF0l50jEUugTJnP6Ms7a3oa7GaLIJ4QAKMZtLTN31iIcW40r2vVwH+J3JyCr/xeUhwT5/MlaN9c5lLjh7eUig2DA8/6DpqPOm+wV+cn6dh2w2I294cSRsUPJJla63g0YTYbPT9RKeC2D5GiyfqCYAEYzvKdlBJ5hCURh5rxrjOCGlde4Inq0uX6AMETOnvJhkvDMQ5cZ2sUKUy4BC021xvVBdQ44MFI5oGAGUIHbhsAs6wKwWo2ZvmJ5A2Oh0Ny6cx+PzGkZVN9afDUeiGQQcXvHFPw/oZrtQo/H8y8YsIQedBbHOY4RUnt/ID2xOOaZ50REIaGPZJq4hXGgggRh14bKcFcAH/DkiMiBi0bMRhxUOUI57T+4F5Jl5AdrZg/j3FjVn4Jv3Xcr/+N6Xp2QIttRkpa3XpE7N3378V7PKMlGQs0YFWGqDKR9hffMgDQ6qC+E7/OylmxIrOHv4545QCfVUuOhkq9v6IINc1XkKZ4r0GpNk33yr08lZ+jlsMKZvycBF5W2Yp8LWkM=
on:
tags: true
branch: master
2 changes: 1 addition & 1 deletion qcloud_cos/cos_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __call__(self, r):
format_str = u"{method}\n{host}\n{params}\n{headers}\n".format(
method=r.method.lower(),
host=path,
params=urlencode(sorted(uri_params.items())).replace('+', '%20'),
params=urlencode(sorted(uri_params.items())).replace('+', '%20').replace('%7E', '~'),
headers='&'.join(map(lambda tupl: "%s=%s" % (tupl[0], tupl[1]), sorted(headers.items())))
)
logger.debug("format str: " + format_str)
Expand Down
6 changes: 4 additions & 2 deletions qcloud_cos/cos_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,10 @@ def send_request(self, method, url, timeout=30, **kwargs):
info['code'] = 'NoSuchResource'
info['message'] = 'The Resource You Head Not Exist'
info['resource'] = url
info['requestid'] = res.headers['x-cos-request-id']
info['traceid'] = res.headers['x-cos-trace-id']
if 'x-cos-request-id' in res.headers:
info['requestid'] = res.headers['x-cos-request-id']
if 'x-cos-trace-id' in res.headers:
info['traceid'] = res.headers['x-cos-trace-id']
logger.error(info)
raise CosServiceError(method, info, res.status_code)
else:
Expand Down
1 change: 1 addition & 0 deletions qcloud_cos/cos_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def xml_to_dict(data, origin_str="", replace_str=""):
xmlstr = xmlstr.replace("{http://www.qcloud.com/document/product/436/7751}", "")
xmlstr = xmlstr.replace("{https://cloud.tencent.com/document/product/436}", "")
xmlstr = xmlstr.replace("{http://doc.s3.amazonaws.com/2006-03-01}", "")
xmlstr = xmlstr.replace("{http://s3.amazonaws.com/doc/2006-03-01/}", "")
xmlstr = xmlstr.replace("{http://www.w3.org/2001/XMLSchema-instance}", "")
if origin_str:
xmlstr = xmlstr.replace(origin_str, replace_str)
Expand Down
5 changes: 4 additions & 1 deletion qcloud_cos/cos_exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ def digest_xml(data):
msg['requestid'] = result[0].childNodes[0].nodeValue

result = root.getElementsByTagName('TraceId')
msg['traceid'] = result[0].childNodes[0].nodeValue
if result:
msg['traceid'] = result[0].childNodes[0].nodeValue
else:
msg['traceid'] = 'Unknown'
return msg
except Exception as e:
return "Response Error Msg Is INVALID"
Expand Down