You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
981B

  1. import io
  2. import json
  3. import cv2
  4. import urllib3
  5. from minio import Minio
  6. # MinIO
  7. minioClient = Minio('192.168.12.5:9000',
  8. access_key='RoZc1NbZ6oAC4lTV',
  9. secret_key='wC01Lup6SIoahwfSrYcoF2gSF3mPy6gJ',
  10. secure=False)
  11. aa = r'C:\Users\chenyukun\Desktop\shipin\DJI_20211229100908_0001_S.mp4'
  12. # # 创建存储桶
  13. # img = cv2.imread(r"D:\work\alg\tuoheng_alg\test\image\1.jpg")
  14. # ai_result, ai_image = cv2.imencode(".jpg", img)
  15. # # minioClient.make_bucket("test/bb")
  16. # print(len(ai_image))
  17. # minioClient.put_object('test', '1.jpg', io.BytesIO(ai_image.tobytes()), len(ai_image))
  18. result = minioClient.fput_object("test", "aa3.mp4", aa)
  19. print(result.__dict__)
  20. # 查看桶信息
  21. # buckets = minioClient.list_buckets()
  22. # for bucket in buckets:
  23. # print(bucket.name, bucket.creation_date)
  24. # 判断桶是否存在
  25. if minioClient.bucket_exists("my-bucket"):
  26. print("my-bucket exists")
  27. else:
  28. print("my-bucket does not exist")