azure-storage-blob12.3.1 CentOS 73.5Describe the bug
A clear and concise description of what the bug is.
Hi, I'm updating one of our libraries to version 12 from 2 and I can't seem to find where progress_callback went when uploading or downloading blobs.
Was this feature removed? Or is it just me that can't find any documentation on this?
To Reproduce
Steps to reproduce the behavior:
client.create_blob_from_path(
azure_location.container_name,
path,
data_file,
progress_callback=azure_callback
)
Hi @sfc-gh-mkeller,
We no longer support the callbacks directly - however you can hook into the request pipeline in much the same way to achieve a similar result.
Here's a small sample from our test suite showing how to do this with the new API:
progress = []
def callback(response):
current = response.context['upload_stream_current'] #There's also a 'download_stream_current'
total = response.context['data_stream_total']
if current is not None:
progress.append((current, total))
with open(FILE_PATH, 'rb') as stream:
blob.upload_blob(stream, max_concurrency=2, raw_response_hook=callback)
Let me know if you need further details :)
Thank you so much for your quick answer @annatisch
I'll give this a go!
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.
Hi @sfc-gh-mkeller
It looks like you've got the answer, so we want to close the issue for now ^_^
feel free to reopen it if you have any concern or question!!
I struggled to find this information for quite some time. As far as I can tell the raw_response_hook appears to be an undocumented API feature: BlobClient.upload_blob
Would you please add this information to the documentation? I'm sure there must be others in search of this information, which is useful even if you aren't upgrading from the legacy SDK, too.
@xiafu-msft @annatisch