35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
from minio import Minio
|
|
from minio.error import S3Error
|
|
|
|
|
|
def main():
|
|
client = Minio(
|
|
"s3.grfc.ru:443",
|
|
access_key="cl-i-oculus-dev1",
|
|
secret_key="Nom8qKEU6IYtQSrNt5ZPN1XncQTZdtUM",
|
|
secure=True
|
|
)
|
|
|
|
# Make 'asiatrip' bucket if not exist.
|
|
found = client.bucket_exists("clean-internet-oculus-integration-dev")
|
|
if not found:
|
|
client.make_bucket("clean-internet-oculus-integration-dev")
|
|
else:
|
|
print("Bucket 'asiatrip' already exists")
|
|
|
|
# Upload '/home/user/Photos/asiaphotos.zip' as object name
|
|
# 'asiaphotos-2015.zip' to bucket 'asiatrip'.
|
|
client.fput_object(
|
|
"clean-internet-oculus-integration-dev", "4uv2GNc_ybc_1080p.mp4", "/Users/garickbadalov/PycharmProjects/video_downloader_service/downloads/Youtube/4uv2GNc_ybc_1080p.mp4",
|
|
)
|
|
print(
|
|
"'/home/user/Photos/asiaphotos.zip' is successfully uploaded as "
|
|
"object 'asiaphotos-2015.zip' to bucket 'asiatrip'."
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
try:
|
|
main()
|
|
except S3Error as exc:
|
|
print("error occurred.", exc) |