multipart_upload_3.py 389 B

1234567891011121314151617
  1. def get_object_info(self):
  2. """
  3. 查看桶内是否以存在同名对象
  4. :return:
  5. """
  6. try:
  7. res = self.s3_client.head_object(
  8. Bucket=DESTINATION_BUCKET,
  9. Key=MULTIPART_UPLOAD_FILE_NAME
  10. )
  11. object_size = res["ContentLength"]
  12. except botocore.exceptions.ClientError:
  13. object_size = -1
  14. return object_size