Skip to content

Commit 5299470

Browse files
committed
support stdin upload
1 parent 9d9fdf5 commit 5299470

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

qcloud_cos/cos_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ def create_bucket(self, Bucket, **kwargs):
968968
method='PUT',
969969
url=url,
970970
bucket=Bucket,
971-
auth=CosS3Auth(self._conf._secret_id, self._conf._secret_key),
971+
auth=CosS3Auth(self._conf),
972972
headers=headers)
973973
return None
974974

@@ -997,7 +997,7 @@ def delete_bucket(self, Bucket, **kwargs):
997997
method='DELETE',
998998
url=url,
999999
bucket=Bucket,
1000-
auth=CosS3Auth(self._conf._secret_id, self._conf._secret_key),
1000+
auth=CosS3Auth(self._conf),
10011001
headers=headers)
10021002
return None
10031003

@@ -1242,7 +1242,7 @@ def head_bucket(self, Bucket, **kwargs):
12421242
method='HEAD',
12431243
url=url,
12441244
bucket=Bucket,
1245-
auth=CosS3Auth(self._conf._secret_id, self._conf._secret_key),
1245+
auth=CosS3Auth(self._conf),
12461246
headers=headers)
12471247
return None
12481248

@@ -2114,7 +2114,7 @@ def list_buckets(self, **kwargs):
21142114
url=url,
21152115
bucket=None,
21162116
headers=headers,
2117-
auth=CosS3Auth(self._conf._secret_id, self._conf._secret_key),
2117+
auth=CosS3Auth(self._conf),
21182118
)
21192119
data = xml_to_dict(rt.content)
21202120
if data['Buckets'] is not None and not isinstance(data['Buckets']['Bucket'], list):

qcloud_cos/cos_comm.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,10 @@ def get_file_like_object_length(data):
348348
else:
349349
# support BytesIO file-like object
350350
total_length = len(data.getvalue())
351-
current_position = data.tell()
351+
try:
352+
current_position = data.tell()
353+
except IOError:
354+
current_position = 0
352355
content_len = total_length - current_position
353356
return content_len
354357

0 commit comments

Comments
 (0)