|
14 | 14 | USAGE:
|
15 | 15 | python blob_samples_common_async.py
|
16 | 16 | Set the environment variables with your own values before running the sample.
|
17 |
| - 1) AZURE_STORAGE_CONNECTION_STRING - the connection string to your storage account |
| 17 | + 1) STORAGE_CONNECTION_STRING - the connection string to your storage account |
18 | 18 | """
|
19 | 19 |
|
20 | 20 | import os
|
21 | 21 | import sys
|
22 | 22 | import asyncio
|
23 | 23 | from azure.core.exceptions import ResourceExistsError
|
24 | 24 |
|
25 |
| - |
26 |
| -SOURCE_FILE = './SampleSource.txt' |
| 25 | +current_dir = os.path.dirname(os.path.abspath(__file__)) |
| 26 | +SOURCE_FILE = os.path.join(current_dir, 'SampleSource.txt') |
27 | 27 |
|
28 | 28 |
|
29 | 29 | class CommonBlobSamplesAsync(object):
|
30 | 30 |
|
31 |
| - connection_string = os.getenv("AZURE_STORAGE_CONNECTION_STRING") |
| 31 | + connection_string = os.getenv("STORAGE_CONNECTION_STRING_SOFT") |
32 | 32 |
|
33 | 33 | #--Begin Blob Samples-----------------------------------------------------------------
|
34 | 34 |
|
35 | 35 | async def blob_snapshots_async(self):
|
36 | 36 | if self.connection_string is None:
|
37 |
| - print("Missing required environment variable: AZURE_STORAGE_CONNECTION_STRING." + '\n' + |
| 37 | + print("Missing required environment variable: STORAGE_CONNECTION_STRING." + '\n' + |
38 | 38 | "Test: blob_snapshots_async")
|
39 | 39 | sys.exit(1)
|
40 | 40 | # Instantiate a BlobServiceClient using a connection string
|
@@ -74,7 +74,7 @@ async def blob_snapshots_async(self):
|
74 | 74 |
|
75 | 75 | async def soft_delete_and_undelete_blob_async(self):
|
76 | 76 | if self.connection_string is None:
|
77 |
| - print("Missing required environment variable: AZURE_STORAGE_CONNECTION_STRING." + '\n' + |
| 77 | + print("Missing required environment variable: STORAGE_CONNECTION_STRING." + '\n' + |
78 | 78 | "Test: soft_delete_and_undelete_blob_async")
|
79 | 79 | sys.exit(1)
|
80 | 80 | # Instantiate a BlobServiceClient using a connection string
|
@@ -120,7 +120,7 @@ async def soft_delete_and_undelete_blob_async(self):
|
120 | 120 |
|
121 | 121 | async def delete_multiple_blobs_async(self):
|
122 | 122 | if self.connection_string is None:
|
123 |
| - print("Missing required environment variable: AZURE_STORAGE_CONNECTION_STRING." + '\n' + |
| 123 | + print("Missing required environment variable: STORAGE_CONNECTION_STRING." + '\n' + |
124 | 124 | "Test: delete_multiple_blobs_async")
|
125 | 125 | sys.exit(1)
|
126 | 126 | # Instantiate a BlobServiceClient using a connection string
|
@@ -158,7 +158,7 @@ async def delete_multiple_blobs_async(self):
|
158 | 158 |
|
159 | 159 | async def acquire_lease_on_blob_async(self):
|
160 | 160 | if self.connection_string is None:
|
161 |
| - print("Missing required environment variable: AZURE_STORAGE_CONNECTION_STRING." + '\n' + |
| 161 | + print("Missing required environment variable: STORAGE_CONNECTION_STRING." + '\n' + |
162 | 162 | "Test: acquire_lease_on_blob_async")
|
163 | 163 | sys.exit(1)
|
164 | 164 | # Instantiate a BlobServiceClient using a connection string
|
@@ -195,7 +195,7 @@ async def acquire_lease_on_blob_async(self):
|
195 | 195 |
|
196 | 196 | async def start_copy_blob_from_url_and_abort_copy_async(self):
|
197 | 197 | if self.connection_string is None:
|
198 |
| - print("Missing required environment variable: AZURE_STORAGE_CONNECTION_STRING." + '\n' + |
| 198 | + print("Missing required environment variable: STORAGE_CONNECTION_STRING." + '\n' + |
199 | 199 | "Test: start_copy_blob_from_url_and_abort_copy_async")
|
200 | 200 | sys.exit(1)
|
201 | 201 | # Instantiate a BlobServiceClient using a connection string
|
|
0 commit comments