Closed flewellyn closed 6 years ago
Not currently, authentication would be checked when performing a REST action on the storage service.
Instead, I can implement a driver property is_authenticated
which returns True
or False
as each driver has a different method for validating credentials. Or would you prefer an Exception
thrown if the credentials are wrong at driver initialization?
I don't really have a preference, either way would work. I suppose the Exception approach would be Pythonic.
Implemented with #35.
pip install cloudstorage==0.9.0
from cloudstorage.drivers.amazon import S3Driver
storage = S3Driver(key='invalid-key',
secret='invalid-secret',
region='us-east-1')
storage.validate_credentials()
# cloudstorage.exceptions.CredentialsError: An error occurred (InvalidClientTokenId) when calling the GetCallerIdentity operation: The security token included in the request is invalid.
Let me know if you run into any issues.
Thanks! I will try it out.
Is there a means of testing the provided authentication to a driver? I would like to be able to account for invalid credentials in configuration.