attstore / tmp /testboto.py
dn-scribe's picture
tmp
86aefc9
Raw History Blame Contribute Delete
833 Bytes
import boto3
from botocore.client import Config as BotoConfig
# ACCESS_KEY = "minio-access-key" # MinIO user access key
# SECRET_KEY = "minio-secret-key" # MinIO user secret
REGION = "il-central-1" # MinIO often uses us-east-1; match server config
BUCKET = "store-att"
OBJECT_KEY = "uv.lock"
EXPIRES = 3600 # seconds
s3 = boto3.client(
"s3",
region_name=REGION,
config=BotoConfig(
s3={"addressing_style": "path"},
signature_version="s3v4"
),
)
url = s3.generate_presigned_url(
ClientMethod="put_object",
Params={
"Bucket": BUCKET,
"Key": OBJECT_KEY,
# Optional but often useful to constrain:
# "ContentType": "application/octet-stream",
},
ExpiresIn=EXPIRES,
HttpMethod="PUT",
)
print(url)