Skip to content

Commit 22b9b8a

Browse files
authored
Merge pull request MicrosoftDocs#73788 from dksimpson/open-github-issues-22188
Remove backslashes in method names
2 parents 126837a + 35a4d0d commit 22b9b8a

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

articles/storage/blobs/storage-quickstart-blobs-python.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ This command clones the *Azure-Samples/storage-blobs-python-quickstart* reposito
4141
In the application, provide your storage account name and account key to create a `BlockBlobService` object. Open the *example.py* file from the Solution Explorer in your IDE. Replace the `accountname` and `accountkey` values with your account name and key.
4242

4343
```python
44-
block_blob_service = BlockBlobService(account_name='accountname', account_key='accountkey')
44+
block_blob_service = BlockBlobService(account_name = 'accountname', account_key = 'accountkey')
4545
```
4646

4747
## Run the sample
@@ -88,11 +88,11 @@ Once you have the Cloud Blob container, instantiate the **CloudBlockBlob** objec
8888
In this section, you instantiate the objects, create a new container, and then set permissions on the container so the blobs are public. The container is called **quickstartblobs**.
8989

9090
```python
91-
# Create the BlockBlockService that is used to call the Blob service for the storage account
92-
block_blob_service = BlockBlobService(account_name='accountname', account_key='accountkey')
91+
# Create the BlockBlockService that is used to call the Blob service for the storage account.
92+
block_blob_service = BlockBlobService(account_name = 'accountname', account_key = 'accountkey')
9393

9494
# Create a container called 'quickstartblobs'.
95-
container_name ='quickstartblobs'
95+
container_name = 'quickstartblobs'
9696
block_blob_service.create_container(container_name)
9797

9898
# Set the permission so the blobs are public.
@@ -102,29 +102,29 @@ block_blob_service.set_container_acl(container_name, public_access=PublicAccess.
102102

103103
Blob storage supports block blobs, append blobs, and page blobs. Block blobs are the most commonly used, and that's what is used in this quickstart.
104104

105-
To upload a file to a blob, get the full file path by joining the directory name with the file name on your local drive. You can then upload the file to the specified path using the `create\_blob\_from\_path` method.
105+
To upload a file to a blob, get the full file path by joining the directory name with the file name on your local drive. You can then upload the file to the specified path using the `create_blob_from_path` method.
106106

107-
The sample code creates a local file to be used for the upload and download, storing the file to be uploaded as `file\_path\_to\_file` and the name of the blob as `local\_file\_name`. The following example uploads the file to your container called **quickstartblobs**.
107+
The sample code creates a local file to be used for the upload and download, storing the file to be uploaded as *full_path_to_file* and the name of the blob as *local_file_name*. The following example uploads the file to your container called **quickstartblobs**.
108108

109109
```python
110110
# Create a file in Documents to test the upload and download.
111-
local_path=os.path.expanduser("~\Documents")
112-
local_file_name ="QuickStart_" + str(uuid.uuid4()) + ".txt"
113-
full_path_to_file =os.path.join(local_path, local_file_name)
111+
local_path = os.path.expanduser("~\Documents")
112+
local_file_name = "QuickStart_" + str(uuid.uuid4()) + ".txt"
113+
full_path_to_file = os.path.join(local_path, local_file_name)
114114

115115
# Write text to the file.
116-
file = open(full_path_to_file, 'w')
116+
file = open(full_path_to_file, 'w')
117117
file.write("Hello, World!")
118118
file.close()
119119

120120
print("Temp file = " + full_path_to_file)
121121
print("\nUploading to Blob storage as blob" + local_file_name)
122122

123-
# Upload the created file, use local_file_name for the blob name
123+
# Upload the created file, use local_file_name for the blob name.
124124
block_blob_service.create_blob_from_path(container_name, local_file_name, full_path_to_file)
125125
```
126126

127-
There are several upload methods that you can use with Blob storage. For example, if you have a memory stream, you can use the `create\_blob\_from\_stream` method rather than `create\_blob\_from\_path`.
127+
There are several upload methods that you can use with Blob storage. For example, if you have a memory stream, you can use the `create_blob_from_stream` method rather than `create_blob_from_path`.
128128

129129
Block blobs can be as large as 4.7 TB, and can be anything from Excel spreadsheets to large video files. Page blobs are primarily used for the VHD files that back IaaS VMs. Append blobs are used for logging, such as when you want to write to a file and then keep adding more information. Most objects stored in Blob storage are block blobs.
130130

@@ -133,7 +133,7 @@ Block blobs can be as large as 4.7 TB, and can be anything from Excel spreadshee
133133
Get a list of files in the container with the `list_blobs` method. This method returns a generator. The following code retrieves the list of blobs—then loops through them—showing the names of the blobs found in a container.
134134

135135
```python
136-
# List the blobs in the container
136+
# List the blobs in the container.
137137
print("\nList blobs in the container")
138138
generator = block_blob_service.list_blobs(container_name)
139139
for blob in generator:
@@ -142,22 +142,22 @@ for blob in generator:
142142

143143
### Download the blobs
144144

145-
Download blobs to your local disk using `the get\_blob\_to\_path` method.
145+
Download blobs to your local disk using the `get_blob_to_path` method.
146146
The following code downloads the blob uploaded in a previous section. *_DOWNLOADED* is added as a suffix to the blob name so you can see both files on local disk.
147147

148148
```python
149149
# Download the blob(s).
150150
# Add '_DOWNLOADED' as prefix to '.txt' so you can see both files in Documents.
151-
full_path_to_file2 = os.path.join(local_path, string.replace(local_file_name ,'.txt', '_DOWNLOADED.txt'))
151+
full_path_to_file2 = os.path.join(local_path, string.replace(local_file_name, '.txt', '_DOWNLOADED.txt'))
152152
print("\nDownloading blob to " + full_path_to_file2)
153153
block_blob_service.get_blob_to_path(container_name, local_file_name, full_path_to_file2)
154154
```
155155

156156
### Clean up resources
157-
If you no longer need the blobs uploaded in this quickstart, you can delete the entire container using the `delete\_container` method. To delete individual files instead, use the `delete\_blob` method.
157+
If you no longer need the blobs uploaded in this quickstart, you can delete the entire container using the `delete_container` method. To delete individual files instead, use the `delete_blob` method.
158158

159159
```python
160-
# Clean up resources. This includes the container and the temp files
160+
# Clean up resources. This includes the container and the temp files.
161161
block_blob_service.delete_container(container_name)
162162
os.remove(full_path_to_file)
163163
os.remove(full_path_to_file2)

0 commit comments

Comments
 (0)