-
Notifications
You must be signed in to change notification settings - Fork 351
Closed
Description
I am not sure if it is by design, but I strongly feel that the example code given for uploading a file in the README is misguiding https://github.com/minio/minio-py#file-uploaderpy . This is because, according to this snippet, the file shall be uploaded only if the bucket does not exist, otherwise, if it exists, the code in the else block will never be executed.
from minio import Minio
from minio.error import (ResponseError, BucketAlreadyOwnedByYou,
BucketAlreadyExists)
# Initialize minioClient with an endpoint and access/secret keys.
minioClient = Minio('play.min.io',
access_key='Q3AM3UQ867SPQQA43P2F',
secret_key='zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
secure=True)
# Make a bucket with the make_bucket API call.
try:
minioClient.make_bucket("maylogs", location="us-east-1")
except BucketAlreadyOwnedByYou as err:
pass
except BucketAlreadyExists as err:
pass
except ResponseError as err:
raise
else:
# Put an object 'pumaserver_debug.log' with contents from 'pumaserver_debug.log'.
try:
minioClient.fput_object('maylogs', 'pumaserver_debug.log', '/tmp/pumaserver_debug.log')
except ResponseError as err:
print(err)
I can take this up and make the change.
Metadata
Metadata
Assignees
Labels
No labels