Skip to content

Commit

Permalink
support stdin upload
Browse files Browse the repository at this point in the history
  • Loading branch information
dt3310321 committed Dec 5, 2018
1 parent 9d9fdf5 commit 5299470
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions qcloud_cos/cos_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ def create_bucket(self, Bucket, **kwargs):
method='PUT',
url=url,
bucket=Bucket,
auth=CosS3Auth(self._conf._secret_id, self._conf._secret_key),
auth=CosS3Auth(self._conf),
headers=headers)
return None

Expand Down Expand Up @@ -997,7 +997,7 @@ def delete_bucket(self, Bucket, **kwargs):
method='DELETE',
url=url,
bucket=Bucket,
auth=CosS3Auth(self._conf._secret_id, self._conf._secret_key),
auth=CosS3Auth(self._conf),
headers=headers)
return None

Expand Down Expand Up @@ -1242,7 +1242,7 @@ def head_bucket(self, Bucket, **kwargs):
method='HEAD',
url=url,
bucket=Bucket,
auth=CosS3Auth(self._conf._secret_id, self._conf._secret_key),
auth=CosS3Auth(self._conf),
headers=headers)
return None

Expand Down Expand Up @@ -2114,7 +2114,7 @@ def list_buckets(self, **kwargs):
url=url,
bucket=None,
headers=headers,
auth=CosS3Auth(self._conf._secret_id, self._conf._secret_key),
auth=CosS3Auth(self._conf),
)
data = xml_to_dict(rt.content)
if data['Buckets'] is not None and not isinstance(data['Buckets']['Bucket'], list):
Expand Down
5 changes: 4 additions & 1 deletion qcloud_cos/cos_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,10 @@ def get_file_like_object_length(data):
else:
# support BytesIO file-like object
total_length = len(data.getvalue())
current_position = data.tell()
try:
current_position = data.tell()
except IOError:
current_position = 0
content_len = total_length - current_position
return content_len

Expand Down

0 comments on commit 5299470

Please sign in to comment.