{"id":205078,"date":"2025-05-29T09:43:20","date_gmt":"2025-05-29T01:43:20","guid":{"rendered":"https:\/\/server.hk\/cnblog\/205078\/"},"modified":"2025-05-29T09:43:20","modified_gmt":"2025-05-29T01:43:20","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-minio-python-sdk-%e5%88%a4%e6%96%ad%e5%af%b9%e8%b1%a1%e6%98%af%e5%90%a6%e5%ad%98%e5%9c%a8%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/205078\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 MinIO Python SDK \u5224\u65ad\u5bf9\u8c61\u662f\u5426\u5b58\u5728\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u4f7f\u7528 MinIO Python SDK \u5224\u65ad\u5bf9\u8c61\u662f\u5426\u5b58\u5728\uff1f<\/h1>\n<p>\u6765\u5230\u7684\u5927\u5bb6\uff0c\u76f8\u4fe1\u90fd\u662f\u7f16\u7a0b\u5b66\u4e60\u7231\u597d\u8005\uff0c\u5e0c\u671b\u5728\u8fd9\u91cc\u5b66\u4e60\u6587\u7ae0\u76f8\u5173\u7f16\u7a0b\u77e5\u8bc6\u3002\u4e0b\u9762\u672c\u7bc7\u6587\u7ae0\u5c31\u6765\u5e26\u5927\u5bb6\u804a\u804a\u300a\u5982\u4f55\u4f7f\u7528 MinIO Python SDK \u5224\u65ad\u5bf9\u8c61\u662f\u5426\u5b58\u5728\uff1f\u300b\uff0c\u4ecb\u7ecd\u4e00\u4e0b\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241123\/1732322732674125ac783ef.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>minio python sdk \u5224\u65ad\u5bf9\u8c61\u662f\u5426\u5b58\u5728<\/strong><\/p>\n<p>\u5982\u4f55\u4f7f\u7528 minio python sdk \u5224\u65ad\u6307\u5b9a\u5bf9\u8c61\u662f\u5426\u5b58\u5728\uff1f\u8fd9\u901a\u5e38\u662f\u5bf9\u8c61\u5b58\u50a8\u670d\u52a1\u4e2d\u4e00\u4e2a\u57fa\u672c\u7684\u529f\u80fd\u3002<\/p>\n<p>minio \u652f\u6301\u4e0e aws s3 \u517c\u5bb9\u7684 api\uff0c\u56e0\u6b64\u6211\u4eec\u53ef\u4ee5\u53c2\u8003 s3 \u5bf9\u8c61\u5b58\u5728\u68c0\u67e5\u65b9\u6cd5\u3002<\/p>\n<p>s3 \u4f7f\u7528 head \u65b9\u6cd5\u83b7\u53d6\u5bf9\u8c61\u4fe1\u606f\uff0c\u5982\u679c\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u629b\u51fa\u5f02\u5e38\u3002minio \u5177\u6709\u7c7b\u4f3c\u7684\u65b9\u6cd5\uff1a<\/p>\n<pre>try:\n    # \u8c03\u7528 stat_object \u65b9\u6cd5\uff0c\u8be5\u65b9\u6cd5\u5c06\u629b\u51fa\u5f02\u5e38\uff08\u4f8b\u5982 MinIOError\uff09\n    # \u5982\u679c\u6307\u5b9a\u5bf9\u8c61\u4e0d\u5b58\u5728\n    client.stat_object(bucket_name, object_name)\n    return True\nexcept MinIOError:\n    return False<\/pre>\n<p>\u56e0\u6b64\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 stat_object \u65b9\u6cd5\u6765\u5224\u65ad minio \u4e2d\u7684\u5bf9\u8c61\u662f\u5426\u5b58\u5728\u3002<\/p>\n<p>\u7406\u8bba\u8981\u638c\u63e1\uff0c\u5b9e\u64cd\u4e0d\u80fd\u843d\uff01\u4ee5\u4e0a\u5173\u4e8e\u300a\u5982\u4f55\u4f7f\u7528 MinIO Python SDK \u5224\u65ad\u5bf9\u8c61\u662f\u5426\u5b58\u5728\uff1f\u300b\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5927\u5bb6\u90fd\u638c\u63e1\u4e86\u5427\uff01\u5982\u679c\u60f3\u8981\u7ee7\u7eed\u63d0\u5347\u81ea\u5df1\u7684\u80fd\u529b\uff0c\u90a3\u4e48\u5c31\u6765\u5173\u6ce8\u516c\u4f17\u53f7\u5427\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f7f\u7528 MinIO Pytho&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-205078","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205078","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=205078"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205078\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=205078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=205078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=205078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}