Last active
July 31, 2024 23:51
-
-
Save tecandrew/14645077ed4765669337507bdfc67e92 to your computer and use it in GitHub Desktop.
digitalocean-minio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from minio import Minio | |
from minio.datatypes import Object | |
import os | |
ACCESS_KEY = os.environ.get("ACCESS_KEY") | |
SECRET_KEY = os.environ.get("SECRET_KEY") | |
# Create client with access key and secret key with specific region. | |
client = Minio( | |
"sfo3.digitaloceanspaces.com", | |
access_key=ACCESS_KEY, | |
secret_key=SECRET_KEY, | |
secure=True, | |
) | |
# list buckets | |
buckets = client.list_buckets() | |
for bucket in buckets: | |
print(f" -- found '{bucket.name}'") | |
# List objects information. | |
objects = client.list_objects(bucket.name) | |
for obj in objects: | |
print(obj) | |
# print(dir(obj)) | |
print(f"name: {obj.object_name}") | |
print(f"type: {obj.content_type}") | |
print(f"is dir?: {obj.is_dir}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
minio |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file was autogenerated by uv via the following command: | |
# uv pip compile requirements.in | |
argon2-cffi==23.1.0 | |
# via minio | |
argon2-cffi-bindings==21.2.0 | |
# via argon2-cffi | |
certifi==2024.7.4 | |
# via minio | |
cffi==1.16.0 | |
# via argon2-cffi-bindings | |
minio==7.2.7 | |
pycparser==2.22 | |
# via cffi | |
pycryptodome==3.20.0 | |
# via minio | |
typing-extensions==4.12.2 | |
# via minio | |
urllib3==2.2.2 | |
# via minio |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment