exoscale/python-exoscale

Add a storage.Bucket/BucketFile "url" attribute

Closed this issue · 1 comments

falzm commented

It'd be convenient to expose a url attribute to the storage.Bucket and storage.BucketFile objects, returning the usable HTTP URL of a SOS bucket or a file stored in it.

Example:

bucket = exoscale.storage.create_bucket("my-bucket", zone="ch-gva-2")
print(bucket.url) # → "https://sos-ch-gva-2.exo.io/my-bucket/"

a_file = bucket.put_file("/path/to/a_file.txt")
print(a_file.url) # → "https://sos-ch-gva-2.exo.io/my-bucket/a_file.txt"
falzm commented

Implemented in #3.