Можно first download the file as stream
, затем вызвать метод create_blob_from_stream
.
Ниже приведен демонстрационный код:
from azure.storage.blob import BlockBlobService, PublicAccess
from azure.storage.blob.models import Blob
import requests
def run_sample():
block_blob_service = BlockBlobService(account_name='your_name', account_key='your_key')
container_name ='t1s'
response = requests.get('https://media.readthedocs.org/pdf/azure-storage/v0.20.3/azure-storage.pdf',stream=True)
block_blob_service.create_blob_from_stream(container_name,'remoteURL.pdf',response.raw)
# Main method.
if __name__ == '__main__':
run_sample()
Результат теста, как показано ниже: