What is boto3.client('S3') returning?
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
There's not really a notion of printing a class object like this (they have no repr or str methods). If you want to get to the class itself and have a look at all of the methods and parameters, you could do this (using your examples above), if you don't know where botocore and boto3 are installed:
>> import boto3>> import botocore>> s = boto3.client('s3')>> print(type(s))<class 'botocore.client.S3'>>> print(botcore.client)<module 'botocore.client' from '/usr/local/lib/python3.7/site-packages/botocore/client.py'>
Now, open the module, '/usr/local/lib/python3.7/site-packages/botocore/client.py', in your favorite editor and see how it works. Additionally, you could have a look at the boto3 and botocore documentation to see how to consume these objects.
This module should be helpful.
https://github.com/j4c0bs/boto3-type
In essence...
>>> import boto3>>> import botocore>>> client = boto3.client('s3')>>> isinstance(client, botocore.client.BaseClient)True>>> client.meta.service_model.service_name's3'>>>
Specific code from the mentioned module follows.
def is_client(client): return isinstance(client, botocore.client.BaseClient)
if is_client(client): return ( client.meta.service_model.service_name.lower() == service_name.strip().lower() )