|
@@ -1,36 +0,0 @@
|
|
-# from fastapi import FastAPI
|
|
|
|
-from minio import Minio
|
|
|
|
-from minio.error import S3Error
|
|
|
|
-
|
|
|
|
-client = Minio('localhost:9000',
|
|
|
|
- access_key='nngIIjuqvRa4aZ1jRb3n',
|
|
|
|
- secret_key='IO8KYbgesqHxMvDDwCu6I9fBEpTVaKXxGV27itBK',
|
|
|
|
- secure=False
|
|
|
|
- )
|
|
|
|
-print("====-=-=-=-=")
|
|
|
|
-def main():
|
|
|
|
- if client.bucket_exists("test"):
|
|
|
|
- print("my-bucket exists")
|
|
|
|
- else:
|
|
|
|
- print("my-bucket does not exist")
|
|
|
|
- print("2====-=-=-=-=")
|
|
|
|
- res = client.fput_object("test","1.jpg","/Users/xuxiaotong/PycharmProjects/pythonProject/2.jpg")
|
|
|
|
- print( res.bucket_name )
|
|
|
|
- client.remove_object(
|
|
|
|
- "test", "2.jpg",
|
|
|
|
- # version_id="dfbd25b3-abec-4184-a4e8-5a35a5c1174d",
|
|
|
|
- )
|
|
|
|
-
|
|
|
|
-if __name__ == "__main__":
|
|
|
|
-
|
|
|
|
- # try:
|
|
|
|
- main()
|
|
|
|
- # except S3Error as exc:
|
|
|
|
- # print("error occurred.", exc)
|
|
|
|
-
|
|
|
|
-# app = FastAPI()
|
|
|
|
-#
|
|
|
|
-#
|
|
|
|
-# @app.get("/")
|
|
|
|
-# async def root():
|
|
|
|
-# return {"message": "Hello World"}
|
|
|