I’m trying to list the containers under an azure account using the python sdk – why do I get the following?
JavaScript
x
3
1
>>> azure.storage.blob.baseblobservice.BaseBlobService(account_name='x', account_key='x').list_containers()
2
>>> <azure.storage.models.ListGenerator at 0x7f7cf935fa58>
3
Surely the above is a call to the function and not a reference to the function itself.
Advertisement
Answer
you get the following according to source code it return ListGenerator(resp, self._list_containers, (), kwargs)
you can access what you want as follow:
python2:
JavaScript
1
6
1
>>> from azure.storage.blob.baseblobservice import BaseBlobService
2
>>> blob_service = BaseBlobService(account_name='x', account_key='x')
3
>>> containers = blob_service.list_containers()
4
>>> for c in containers:
5
print c.name
6
python3
JavaScript
1
6
1
>>> from azure.storage.blob.baseblobservice import BaseBlobService
2
>>> blob_service = BaseBlobService(account_name='x', account_key='x')
3
>>> containers = blob_service.list_containers()
4
>>> for c in containers:
5
print(c.name)
6