exoscale / python-exoscale

Python bindings for the Exoscale APIs
https://exoscale.github.io/python-exoscale/
ISC License
15 stars 8 forks source link

Add a storage.Bucket/BucketFile "url" attribute #2

Closed falzm closed 5 years ago

falzm commented 5 years ago

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 5 years ago

Implemented in #3.