Download tmp/testboto.py from dn-scribe/attstore: direct link, hf CLI and curl.
- Browser
- Download file 833 Bytes
-
https://huggingface.co/spaces/dn-scribe/attstore/resolve/main/tmp/testboto.py
- Command line
-
hf download hf://spaces/dn-scribe/attstore/tmp/testboto.py
-
curl -L -o testboto.py https://huggingface.co/spaces/dn-scribe/attstore/resolve/main/tmp/testboto.py
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) | |