Skip to content

Commit 9f00b98

Browse files
authored
Merge pull request #65 from dt3310321/s3
S3
2 parents 07d95d8 + 8b37d5a commit 9f00b98

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ deploy:
1818
provider: pypi
1919
distributions: sdist bdist_wheel
2020
user: dt3310321
21-
password: *********
21+
password:
22+
secure: LoSq2wZPbXJ4DkYCQk6Oi0mI6iwhAiE6Xgyvl+Rv1geYqPTuI8ht7dps2ENHM2gj8JqhsZ7C5p/g9P6YuIBk0OTYKewHgHBnUAQwePzu0N1ofzJtJVoSbhW0aPeNfF6DxkTPscBGCHuMyHb/r/buHa3hLoJKxF0l50jEUugTJnP6Ms7a3oa7GaLIJ4QAKMZtLTN31iIcW40r2vVwH+J3JyCr/xeUhwT5/MlaN9c5lLjh7eUig2DA8/6DpqPOm+wV+cn6dh2w2I294cSRsUPJJla63g0YTYbPT9RKeC2D5GiyfqCYAEYzvKdlBJ5hCURh5rxrjOCGlde4Inq0uX6AMETOnvJhkvDMQ5cZ2sUKUy4BC021xvVBdQ44MFI5oGAGUIHbhsAs6wKwWo2ZvmJ5A2Oh0Ny6cx+PzGkZVN9afDUeiGQQcXvHFPw/oZrtQo/H8y8YsIQedBbHOY4RUnt/ID2xOOaZ50REIaGPZJq4hXGgggRh14bKcFcAH/DkiMiBi0bMRhxUOUI57T+4F5Jl5AdrZg/j3FjVn4Jv3Xcr/+N6Xp2QIttRkpa3XpE7N3378V7PKMlGQs0YFWGqDKR9hffMgDQ6qC+E7/OylmxIrOHv4545QCfVUuOhkq9v6IINc1XkKZ4r0GpNk33yr08lZ+jlsMKZvycBF5W2Yp8LWkM=
2223
on:
2324
tags: true
2425
branch: master

qcloud_cos/cos_auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __call__(self, r):
5050
format_str = u"{method}\n{host}\n{params}\n{headers}\n".format(
5151
method=r.method.lower(),
5252
host=path,
53-
params=urlencode(sorted(uri_params.items())).replace('+', '%20'),
53+
params=urlencode(sorted(uri_params.items())).replace('+', '%20').replace('%7E', '~'),
5454
headers='&'.join(map(lambda tupl: "%s=%s" % (tupl[0], tupl[1]), sorted(headers.items())))
5555
)
5656
logger.debug("format str: " + format_str)

qcloud_cos/cos_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,10 @@ def send_request(self, method, url, timeout=30, **kwargs):
185185
info['code'] = 'NoSuchResource'
186186
info['message'] = 'The Resource You Head Not Exist'
187187
info['resource'] = url
188-
info['requestid'] = res.headers['x-cos-request-id']
189-
info['traceid'] = res.headers['x-cos-trace-id']
188+
if 'x-cos-request-id' in res.headers:
189+
info['requestid'] = res.headers['x-cos-request-id']
190+
if 'x-cos-trace-id' in res.headers:
191+
info['traceid'] = res.headers['x-cos-trace-id']
190192
logger.error(info)
191193
raise CosServiceError(method, info, res.status_code)
192194
else:

qcloud_cos/cos_comm.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ def xml_to_dict(data, origin_str="", replace_str=""):
146146
xmlstr = xmlstr.replace("{http://www.qcloud.com/document/product/436/7751}", "")
147147
xmlstr = xmlstr.replace("{https://cloud.tencent.com/document/product/436}", "")
148148
xmlstr = xmlstr.replace("{http://doc.s3.amazonaws.com/2006-03-01}", "")
149+
xmlstr = xmlstr.replace("{http://s3.amazonaws.com/doc/2006-03-01/}", "")
149150
xmlstr = xmlstr.replace("{http://www.w3.org/2001/XMLSchema-instance}", "")
150151
if origin_str:
151152
xmlstr = xmlstr.replace(origin_str, replace_str)

qcloud_cos/cos_exception.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ def digest_xml(data):
2727
msg['requestid'] = result[0].childNodes[0].nodeValue
2828

2929
result = root.getElementsByTagName('TraceId')
30-
msg['traceid'] = result[0].childNodes[0].nodeValue
30+
if result:
31+
msg['traceid'] = result[0].childNodes[0].nodeValue
32+
else:
33+
msg['traceid'] = 'Unknown'
3134
return msg
3235
except Exception as e:
3336
return "Response Error Msg Is INVALID"

0 commit comments

Comments
 (0)