Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is boto3.client('S3') returning?

I can see:

s = boto3.client('s3')
print(type(s))

prints

<class 'botocore.client.S3'>

But if I try

print(botocore.client.S3)

I get

AttributeError: module 'botocore.client' has no attribute 'S3'

How come?

Side note: My end goal is to return a mock that is speced to what botocore.client.S3 has to offer, but the technical aspect of what is being returned has alluded me for some time, and from knowing that, I'll probably know how to answer my ultimate question.

like image 521
J. Doe Avatar asked Jun 30 '18 21:06

J. Doe


1 Answers

Through a bit of trial and error, found out the instance type that can be used:

>>> import boto3
>>> import botocore
>>> isinstance(boto3.client('s3'), botocore.client.BaseClient)
True
like image 79
pacificgilly1992 Avatar answered Oct 15 '22 19:10

pacificgilly1992