twisted / txaws

Twisted-based Asynchronous Libraries for Amazon Web Services and clouds that support the AWS APIs
MIT License
32 stars 18 forks source link

Replace `AWSCredentials()` with some better APIs #64

Open exarkun opened 7 years ago

exarkun commented 7 years ago

Currently it's possible to get a credentials object with filled-out values like this:

from txaws.credentials import AWSCredentials
credentials = AWSCredentials()

This will check the environment:

This is a lot of behavior to get from just instantiating the class with no arguments.

I suggest the following APIs instead:

Most application code will probably want to use the first form.

Special-purpose applications (such as the txaws integration test suite) will probably want the second form (eg `AWSCredentials.from_profile("txaws-integration-tests", ...).

And the last one is a necessary building block for the first two. It's also just good form to have an object behave this way. And it may even be directly useful to some applications that store credentials somewhere other than in the environment or a credentials file.

Julian commented 7 years ago

Uh, I think I acked on IRC, but +1.