1234567891011121314151617 |
- def create_blob_link(self, blob_folder, blob_name) -> str:
- if blob_folder:
- full_path_blob = f"{blob_folder}/{blob_name}"
- else:
- full_path_blob = blob_name
- url = f"https://{self.account_name}.blob.core.windows.net/{self.destination}/{full_path_blob}"
- sas_token = generate_blob_sas(
- account_name=self.account_name,
- account_key=self.account_key,
- container_name=self.destination,
- blob_name=full_path_blob,
- permission=BlobSasPermissions(read=True, delete_previous_version=False),
- expiry=datetime.utcnow() + timedelta(days=self.expiry_download_links),
- )
- url_with_sas = f"{url}?{sas_token}"
- return url_with_sas
|