3
3
import json
4
4
5
5
import azure .functions as func
6
- import azurefunctions .extensions .bindings .blob as bindings
6
+ import azurefunctions .extensions .bindings .blob as blob
7
7
8
8
app = func .FunctionApp (http_auth_level = func .AuthLevel .ANONYMOUS )
9
9
@@ -25,7 +25,7 @@ def put_bc_trigger(req: func.HttpRequest, file: func.Out[str]) -> str:
25
25
@app .blob_output (arg_name = "$return" ,
26
26
path = "python-worker-tests/test-blobclient-triggered.txt" ,
27
27
connection = "AzureWebJobsStorage" )
28
- def bc_blob_trigger (client : bindings .BlobClient ) -> str :
28
+ def bc_blob_trigger (client : blob .BlobClient ) -> str :
29
29
blob_properties = client .get_blob_properties ()
30
30
file = client .download_blob (encoding = 'utf-8' ).readall ()
31
31
return json .dumps ({
@@ -41,7 +41,7 @@ def bc_blob_trigger(client: bindings.BlobClient) -> str:
41
41
connection = "AzureWebJobsStorage" )
42
42
@app .route (route = "get_bc_blob_triggered" )
43
43
def get_bc_blob_triggered (req : func .HttpRequest ,
44
- client : bindings .BlobClient ) -> str :
44
+ client : blob .BlobClient ) -> str :
45
45
return client .download_blob (encoding = 'utf-8' ).readall ()
46
46
47
47
@@ -62,7 +62,7 @@ def put_cc_trigger(req: func.HttpRequest, file: func.Out[str]) -> str:
62
62
@app .blob_output (arg_name = "$return" ,
63
63
path = "python-worker-tests/test-containerclient-triggered.txt" ,
64
64
connection = "AzureWebJobsStorage" )
65
- def cc_blob_trigger (client : bindings .ContainerClient ) -> str :
65
+ def cc_blob_trigger (client : blob .ContainerClient ) -> str :
66
66
container_properties = client .get_container_properties ()
67
67
file = client .download_blob ("test-containerclient-trigger.txt" ,
68
68
encoding = 'utf-8' ).readall ()
@@ -78,7 +78,7 @@ def cc_blob_trigger(client: bindings.ContainerClient) -> str:
78
78
connection = "AzureWebJobsStorage" )
79
79
@app .route (route = "get_cc_blob_triggered" )
80
80
def get_cc_blob_triggered (req : func .HttpRequest ,
81
- client : bindings .ContainerClient ) -> str :
81
+ client : blob .ContainerClient ) -> str :
82
82
return client .download_blob ("test-containerclient-triggered.txt" ,
83
83
encoding = 'utf-8' ).readall ()
84
84
@@ -100,7 +100,7 @@ def put_ssd_trigger(req: func.HttpRequest, file: func.Out[str]) -> str:
100
100
@app .blob_output (arg_name = "$return" ,
101
101
path = "python-worker-tests/test-ssd-triggered.txt" ,
102
102
connection = "AzureWebJobsStorage" )
103
- def ssd_blob_trigger (stream : bindings .StorageStreamDownloader ) -> str :
103
+ def ssd_blob_trigger (stream : blob .StorageStreamDownloader ) -> str :
104
104
# testing chunking
105
105
file = ""
106
106
for chunk in stream .chunks ():
@@ -116,7 +116,7 @@ def ssd_blob_trigger(stream: bindings.StorageStreamDownloader) -> str:
116
116
connection = "AzureWebJobsStorage" )
117
117
@app .route (route = "get_ssd_blob_triggered" )
118
118
def get_ssd_blob_triggered (req : func .HttpRequest ,
119
- stream : bindings .StorageStreamDownloader ) -> str :
119
+ stream : blob .StorageStreamDownloader ) -> str :
120
120
return stream .readall ().decode ('utf-8' )
121
121
122
122
@@ -125,7 +125,7 @@ def get_ssd_blob_triggered(req: func.HttpRequest,
125
125
@app .blob_input (arg_name = "client" ,
126
126
path = "python-worker-tests/test-blob-extension-bytes.txt" ,
127
127
connection = "AzureWebJobsStorage" )
128
- def get_bc_bytes (req : func .HttpRequest , client : bindings .BlobClient ) -> str :
128
+ def get_bc_bytes (req : func .HttpRequest , client : blob .BlobClient ) -> str :
129
129
return client .download_blob (encoding = 'utf-8' ).readall ()
130
130
131
131
@@ -135,7 +135,7 @@ def get_bc_bytes(req: func.HttpRequest, client: bindings.BlobClient) -> str:
135
135
path = "python-worker-tests/test-blob-extension-bytes.txt" ,
136
136
connection = "AzureWebJobsStorage" )
137
137
def get_cc_bytes (req : func .HttpRequest ,
138
- client : bindings .ContainerClient ) -> str :
138
+ client : blob .ContainerClient ) -> str :
139
139
return client .download_blob ("test-blob-extension-bytes.txt" ,
140
140
encoding = 'utf-8' ).readall ()
141
141
@@ -146,7 +146,7 @@ def get_cc_bytes(req: func.HttpRequest,
146
146
path = "python-worker-tests/test-blob-extension-bytes.txt" ,
147
147
connection = "AzureWebJobsStorage" )
148
148
def get_ssd_bytes (req : func .HttpRequest ,
149
- stream : bindings .StorageStreamDownloader ) -> str :
149
+ stream : blob .StorageStreamDownloader ) -> str :
150
150
return stream .readall ().decode ('utf-8' )
151
151
152
152
@@ -155,7 +155,7 @@ def get_ssd_bytes(req: func.HttpRequest,
155
155
@app .blob_input (arg_name = "client" ,
156
156
path = "python-worker-tests/test-blob-extension-str.txt" ,
157
157
connection = "AzureWebJobsStorage" )
158
- def get_bc_str (req : func .HttpRequest , client : bindings .BlobClient ) -> str :
158
+ def get_bc_str (req : func .HttpRequest , client : blob .BlobClient ) -> str :
159
159
return client .download_blob (encoding = 'utf-8' ).readall ()
160
160
161
161
@@ -164,7 +164,7 @@ def get_bc_str(req: func.HttpRequest, client: bindings.BlobClient) -> str:
164
164
@app .blob_input (arg_name = "client" ,
165
165
path = "python-worker-tests" ,
166
166
connection = "AzureWebJobsStorage" )
167
- def get_cc_str (req : func .HttpRequest , client : bindings .ContainerClient ) -> str :
167
+ def get_cc_str (req : func .HttpRequest , client : blob .ContainerClient ) -> str :
168
168
return client .download_blob ("test-blob-extension-str.txt" ,
169
169
encoding = 'utf-8' ).readall ()
170
170
@@ -174,7 +174,7 @@ def get_cc_str(req: func.HttpRequest, client: bindings.ContainerClient) -> str:
174
174
@app .blob_input (arg_name = "stream" ,
175
175
path = "python-worker-tests/test-blob-extension-str.txt" ,
176
176
connection = "AzureWebJobsStorage" )
177
- def get_ssd_str (req : func .HttpRequest , stream : bindings .StorageStreamDownloader ) -> str :
177
+ def get_ssd_str (req : func .HttpRequest , stream : blob .StorageStreamDownloader ) -> str :
178
178
return stream .readall ().decode ('utf-8' )
179
179
180
180
@@ -188,7 +188,7 @@ def get_ssd_str(req: func.HttpRequest, stream: bindings.StorageStreamDownloader)
188
188
path = "python-worker-tests/test-blob-extension-str.txt" ,
189
189
data_type = "STRING" ,
190
190
connection = "AzureWebJobsStorage" )
191
- def bc_and_inputstream_input (req : func .HttpRequest , client : bindings .BlobClient ,
191
+ def bc_and_inputstream_input (req : func .HttpRequest , client : blob .BlobClient ,
192
192
blob : func .InputStream ) -> str :
193
193
output_msg = ""
194
194
file = blob .read ().decode ('utf-8' )
@@ -208,7 +208,7 @@ def bc_and_inputstream_input(req: func.HttpRequest, client: bindings.BlobClient,
208
208
data_type = "STRING" ,
209
209
connection = "AzureWebJobsStorage" )
210
210
def inputstream_and_bc_input (req : func .HttpRequest , blob : func .InputStream ,
211
- client : bindings .BlobClient ) -> str :
211
+ client : blob .BlobClient ) -> str :
212
212
output_msg = ""
213
213
file = blob .read ().decode ('utf-8' )
214
214
client_file = client .download_blob (encoding = 'utf-8' ).readall ()
@@ -223,9 +223,9 @@ def inputstream_and_bc_input(req: func.HttpRequest, blob: func.InputStream,
223
223
data_type = "STRING" ,
224
224
connection = "AzureWebJobsStorage" )
225
225
def type_undefined (req : func .HttpRequest , file ) -> str :
226
- assert not isinstance (file , bindings .BlobClient )
227
- assert not isinstance (file , bindings .ContainerClient )
228
- assert not isinstance (file , bindings .StorageStreamDownloader )
226
+ assert not isinstance (file , blob .BlobClient )
227
+ assert not isinstance (file , blob .ContainerClient )
228
+ assert not isinstance (file , blob .StorageStreamDownloader )
229
229
return file .read ().decode ('utf-8' )
230
230
231
231
@@ -255,5 +255,5 @@ def put_blob_bytes(req: func.HttpRequest, file: func.Out[bytes]) -> str:
255
255
connection = "AzureWebJobsStorage" )
256
256
@app .route (route = "blob_cache" )
257
257
def blob_cache (req : func .HttpRequest ,
258
- client : bindings .BlobClient ) -> str :
258
+ client : blob .BlobClient ) -> str :
259
259
return client .download_blob (encoding = 'utf-8' ).readall ()
0 commit comments