|
@@ -8,27 +8,24 @@ def main():
|
|
|
# Create a client with the MinIO server playground, its access key
|
|
|
# and secret key.
|
|
|
client = Minio(
|
|
|
- "play.min.io",
|
|
|
- access_key="Q3AM3UQ867SPQQA43P2F",
|
|
|
- secret_key="zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG",
|
|
|
- )
|
|
|
-
|
|
|
- # Make 'asiatrip' bucket if not exist.
|
|
|
- found = client.bucket_exists("asiatrip")
|
|
|
+ "172.17.0.2:9000",
|
|
|
+ access_key="minio",
|
|
|
+ secret_key="miniokey",
|
|
|
+ secure=False,
|
|
|
+ )
|
|
|
+
|
|
|
+ # Make bucket if not exist.
|
|
|
+ found = client.bucket_exists("my-bucket")
|
|
|
if not found:
|
|
|
- client.make_bucket("asiatrip")
|
|
|
+ client.make_bucket("my-bucket")
|
|
|
else:
|
|
|
- print("Bucket 'asiatrip' already exists")
|
|
|
+ print("Bucket 'my-bucket' already exists")
|
|
|
|
|
|
- # Upload '/home/user/Photos/asiaphotos.zip' as object name
|
|
|
- # 'asiaphotos-2015.zip' to bucket 'asiatrip'.
|
|
|
+ # Upload
|
|
|
client.fput_object(
|
|
|
- "asiatrip", "asiaphotos-2015.zip", "/home/user/Photos/asiaphotos.zip",
|
|
|
- )
|
|
|
- print(
|
|
|
- "'/home/user/Photos/asiaphotos.zip' is successfully uploaded as "
|
|
|
- "object 'asiaphotos-2015.zip' to bucket 'asiatrip'."
|
|
|
+ "my-bucket", "hello.txt", "./test/data/hello.txt",
|
|
|
)
|
|
|
+ print("Success")
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|