You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the S3Client needs the credentials to be used, but what happens if i already have a boto3 client somewhere initialized and i want to use the S3Client class?
Is it possible to allow for the S3Client to take a boto3 client that has already been created? It would be simply passing the client at the constructor
The text was updated successfully, but these errors were encountered:
I think it should be possible. It may also require that you pass the session as well (which we currently support).
Out of curiosity, what is the scenario where you already have a client? What parameters are you using in constructing the client that you can't use with the current instantiation approach?
Out of curiosity, what is the scenario where you already have a client? What parameters are you using in constructing the client that you can't use with the current instantiation approach?
I use the Lithops framework to execute serverless functions. Lithops has a storage class, and this storage class is just a wrapper around boto3, Lithops exposes a get_client from whom i could get the boto3 client.
The idea of course is that Lithops has it's own config file and from where initializes everything, and to not pass the credentials through the code, it would be interesting to initialize the S3Client with the boto3 client.
This would be good because it would allow for unit tests to inject a mocked S3 client object. Currently we use moto for mocking AWS S3, but it would be one dependency less and way easier to mock S3 if cloudpathlib allowed for injecting existing S3 clients. And it would in general fulfill the dependency injection paradigm.
Of course it is also very convenient as it is right now. So it would be even better if this way of injecting the S3 client would remain optional.
Currently the S3Client needs the credentials to be used, but what happens if i already have a boto3 client somewhere initialized and i want to use the S3Client class?
Is it possible to allow for the S3Client to take a boto3 client that has already been created? It would be simply passing the client at the constructor
The text was updated successfully, but these errors were encountered: