|
11 | 11 | import xml.dom.minidom |
12 | 12 | import xml.etree.ElementTree |
13 | 13 | from requests import Request, Session |
| 14 | +from datetime import datetime |
14 | 15 | from urllib import quote |
15 | 16 | from hashlib import md5 |
16 | 17 | from streambody import StreamBody |
@@ -152,7 +153,7 @@ def send_request(self, method, url, timeout=30, **kwargs): |
152 | 153 | timeout = self._conf._timeout |
153 | 154 | if self._conf._token is not None: |
154 | 155 | kwargs['headers']['x-cos-security-token'] = self._conf._token |
155 | | - kwargs['headers']['User-Agent'] = 'cos-python-sdk-v5.1.4.0' |
| 156 | + kwargs['headers']['User-Agent'] = 'cos-python-sdk-v5.1.4.1' |
156 | 157 | try: |
157 | 158 | for j in range(self._retry): |
158 | 159 | if method == 'POST': |
@@ -214,6 +215,7 @@ def put_object(self, Bucket, Body, Key, EnableMD5=False, **kwargs): |
214 | 215 | ) |
215 | 216 | print response['ETag'] |
216 | 217 | """ |
| 218 | + check_object_content_length(Body) |
217 | 219 | headers = mapped(kwargs) |
218 | 220 | if 'Metadata' in headers.keys(): |
219 | 221 | for i in headers['Metadata'].keys(): |
@@ -579,6 +581,7 @@ def upload_part(self, Bucket, Key, Body, PartNumber, UploadId, EnableMD5=False, |
579 | 581 | Key='test.txt' |
580 | 582 | ) |
581 | 583 | """ |
| 584 | + check_object_content_length(Body) |
582 | 585 | headers = mapped(kwargs) |
583 | 586 | url = self._conf.uri(bucket=Bucket, path=quote(Key, '/-_.~')+"?partNumber={PartNumber}&uploadId={UploadId}".format( |
584 | 587 | PartNumber=PartNumber, |
@@ -1334,7 +1337,7 @@ def put_bucket_lifecycle(self, Bucket, LifecycleConfiguration={}, **kwargs): |
1334 | 1337 | lifecycle_config = { |
1335 | 1338 | 'Rule': [ |
1336 | 1339 | { |
1337 | | - 'Expiration': {'Days': 100}, |
| 1340 | + 'Expiration': {'Date': get_date(2018, 4, 24)}, |
1338 | 1341 | 'ID': '123', |
1339 | 1342 | 'Filter': {'Prefix': ''}, |
1340 | 1343 | 'Status': 'Enabled', |
|
0 commit comments