Using blob.upload_blob from blob.aio causes Unclosed client session
Test code taken from the documentation: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/storage/azure-storage-blob
and samples: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/storage/azure-storage-blob/tests
Code :
import azure.storage.blob.aio as storage
import asyncio
async def uploadBlob():
with open("./info.txt", "rb") as data:
await blob.upload_blob(data)
blob = storage.BlobClient.from_connection_string("DefaultEndpointsProtocol=https;AccountName=xxx;AccountKey=xxxx;EndpointSuffix=core.windows.net", container="asynctest", blob="my_blob")
#asyncio.run(uploadBlob())
loop = asyncio.get_event_loop()
loop.run_until_complete(uploadBlob())
Causes:
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000001D33B5C8988>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000001D33B7139A8>, 113308.796)]']
connector: <aiohttp.connector.TCPConnector object at 0x000001D33B5C87C8>
Using blob.upload_blob from blob.aio causes Unclosed client session
Test code taken from the documentation: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/storage/azure-storage-blob
and samples: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/storage/azure-storage-blob/tests
Code :
import azure.storage.blob.aio as storageimport asyncioasync def uploadBlob():with open("./info.txt", "rb") as data:await blob.upload_blob(data)blob = storage.BlobClient.from_connection_string("DefaultEndpointsProtocol=https;AccountName=xxx;AccountKey=xxxx;EndpointSuffix=core.windows.net", container="asynctest", blob="my_blob")#asyncio.run(uploadBlob())loop = asyncio.get_event_loop()loop.run_until_complete(uploadBlob())Causes:
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000001D33B5C8988>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000001D33B7139A8>, 113308.796)]']
connector: <aiohttp.connector.TCPConnector object at 0x000001D33B5C87C8>