azure-storage-blob 12.22.0__py3-none-any.whl → 12.23.0b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- azure/storage/blob/_serialize.py +1 -0
- azure/storage/blob/_shared/shared_access_signature.py +20 -2
- azure/storage/blob/_shared_access_signature.py +42 -1
- azure/storage/blob/_version.py +1 -1
- {azure_storage_blob-12.22.0.dist-info → azure_storage_blob-12.23.0b1.dist-info}/METADATA +4 -4
- {azure_storage_blob-12.22.0.dist-info → azure_storage_blob-12.23.0b1.dist-info}/RECORD +9 -9
- {azure_storage_blob-12.22.0.dist-info → azure_storage_blob-12.23.0b1.dist-info}/LICENSE +0 -0
- {azure_storage_blob-12.22.0.dist-info → azure_storage_blob-12.23.0b1.dist-info}/WHEEL +0 -0
- {azure_storage_blob-12.22.0.dist-info → azure_storage_blob-12.23.0b1.dist-info}/top_level.txt +0 -0
azure/storage/blob/_serialize.py
CHANGED
@@ -107,8 +107,17 @@ class SharedAccessSignature(object):
|
|
107
107
|
self.account_key = account_key
|
108
108
|
self.x_ms_version = x_ms_version
|
109
109
|
|
110
|
-
def generate_account(
|
111
|
-
|
110
|
+
def generate_account(
|
111
|
+
self, services,
|
112
|
+
resource_types,
|
113
|
+
permission,
|
114
|
+
expiry,
|
115
|
+
start=None,
|
116
|
+
ip=None,
|
117
|
+
protocol=None,
|
118
|
+
sts_hook=None,
|
119
|
+
**kwargs
|
120
|
+
) -> str:
|
112
121
|
'''
|
113
122
|
Generates a shared access signature for the account.
|
114
123
|
Use the returned signature with the sas_token parameter of the service
|
@@ -152,6 +161,10 @@ class SharedAccessSignature(object):
|
|
152
161
|
:keyword str encryption_scope:
|
153
162
|
Optional. If specified, this is the encryption scope to use when sending requests
|
154
163
|
authorized with this SAS URI.
|
164
|
+
:param sts_hook:
|
165
|
+
For debugging purposes only. If provided, the hook is called with the string to sign
|
166
|
+
that was used to generate the SAS.
|
167
|
+
:type sts_hook: Optional[Callable[[str], None]]
|
155
168
|
:returns: The generated SAS token for the account.
|
156
169
|
:rtype: str
|
157
170
|
'''
|
@@ -161,12 +174,16 @@ class SharedAccessSignature(object):
|
|
161
174
|
sas.add_encryption_scope(**kwargs)
|
162
175
|
sas.add_account_signature(self.account_name, self.account_key)
|
163
176
|
|
177
|
+
if sts_hook is not None:
|
178
|
+
sts_hook(sas.string_to_sign)
|
179
|
+
|
164
180
|
return sas.get_token()
|
165
181
|
|
166
182
|
|
167
183
|
class _SharedAccessHelper(object):
|
168
184
|
def __init__(self):
|
169
185
|
self.query_dict = {}
|
186
|
+
self.string_to_sign = ""
|
170
187
|
|
171
188
|
def _add_query(self, name, val):
|
172
189
|
if val:
|
@@ -229,6 +246,7 @@ class _SharedAccessHelper(object):
|
|
229
246
|
|
230
247
|
self._add_query(QueryStringConstants.SIGNED_SIGNATURE,
|
231
248
|
sign_string(account_key, string_to_sign))
|
249
|
+
self.string_to_sign = string_to_sign
|
232
250
|
|
233
251
|
def get_token(self) -> str:
|
234
252
|
return '&'.join([f'{n}={url_quote(v)}' for n, v in self.query_dict.items() if v is not None])
|
@@ -5,7 +5,10 @@
|
|
5
5
|
# --------------------------------------------------------------------------
|
6
6
|
# pylint: disable=docstring-keyword-should-match-keyword-only
|
7
7
|
|
8
|
-
from typing import
|
8
|
+
from typing import (
|
9
|
+
Any, Callable, Optional, Union,
|
10
|
+
TYPE_CHECKING
|
11
|
+
)
|
9
12
|
from urllib.parse import parse_qs
|
10
13
|
|
11
14
|
from ._shared import sign_string, url_quote
|
@@ -64,6 +67,7 @@ class BlobSharedAccessSignature(SharedAccessSignature):
|
|
64
67
|
content_encoding: Optional[str] = None,
|
65
68
|
content_language: Optional[str] = None,
|
66
69
|
content_type: Optional[str] = None,
|
70
|
+
sts_hook: Optional[Callable[[str], None]] = None,
|
67
71
|
**kwargs: Any
|
68
72
|
) -> str:
|
69
73
|
'''
|
@@ -132,6 +136,10 @@ class BlobSharedAccessSignature(SharedAccessSignature):
|
|
132
136
|
:param str content_type:
|
133
137
|
Response header value for Content-Type when resource is accessed
|
134
138
|
using this shared access signature.
|
139
|
+
:param sts_hook:
|
140
|
+
For debugging purposes only. If provided, the hook is called with the string to sign
|
141
|
+
that was used to generate the SAS.
|
142
|
+
:type sts_hook: Optional[Callable[[str], None]]
|
135
143
|
:return: A Shared Access Signature (sas) token.
|
136
144
|
:rtype: str
|
137
145
|
'''
|
@@ -155,6 +163,9 @@ class BlobSharedAccessSignature(SharedAccessSignature):
|
|
155
163
|
sas.add_resource_signature(self.account_name, self.account_key, resource_path,
|
156
164
|
user_delegation_key=self.user_delegation_key)
|
157
165
|
|
166
|
+
if sts_hook is not None:
|
167
|
+
sts_hook(sas.string_to_sign)
|
168
|
+
|
158
169
|
return sas.get_token()
|
159
170
|
|
160
171
|
def generate_container(
|
@@ -170,6 +181,7 @@ class BlobSharedAccessSignature(SharedAccessSignature):
|
|
170
181
|
content_encoding: Optional[str] = None,
|
171
182
|
content_language: Optional[str] = None,
|
172
183
|
content_type: Optional[str] = None,
|
184
|
+
sts_hook: Optional[Callable[[str], None]] = None,
|
173
185
|
**kwargs: Any
|
174
186
|
) -> str:
|
175
187
|
'''
|
@@ -228,6 +240,10 @@ class BlobSharedAccessSignature(SharedAccessSignature):
|
|
228
240
|
:param str content_type:
|
229
241
|
Response header value for Content-Type when resource is accessed
|
230
242
|
using this shared access signature.
|
243
|
+
:param sts_hook:
|
244
|
+
For debugging purposes only. If provided, the hook is called with the string to sign
|
245
|
+
that was used to generate the SAS.
|
246
|
+
:type sts_hook: Optional[Callable[[str], None]]
|
231
247
|
:return: A Shared Access Signature (sas) token.
|
232
248
|
:rtype: str
|
233
249
|
'''
|
@@ -242,6 +258,10 @@ class BlobSharedAccessSignature(SharedAccessSignature):
|
|
242
258
|
sas.add_info_for_hns_account(**kwargs)
|
243
259
|
sas.add_resource_signature(self.account_name, self.account_key, container_name,
|
244
260
|
user_delegation_key=self.user_delegation_key)
|
261
|
+
|
262
|
+
if sts_hook is not None:
|
263
|
+
sts_hook(sas.string_to_sign)
|
264
|
+
|
245
265
|
return sas.get_token()
|
246
266
|
|
247
267
|
|
@@ -316,6 +336,7 @@ class _BlobSharedAccessHelper(_SharedAccessHelper):
|
|
316
336
|
self._add_query(QueryStringConstants.SIGNED_SIGNATURE,
|
317
337
|
sign_string(account_key if user_delegation_key is None else user_delegation_key.value,
|
318
338
|
string_to_sign))
|
339
|
+
self.string_to_sign = string_to_sign
|
319
340
|
|
320
341
|
def get_token(self) -> str:
|
321
342
|
# a conscious decision was made to exclude the timestamp in the generated token
|
@@ -335,6 +356,7 @@ def generate_account_sas(
|
|
335
356
|
ip: Optional[str] = None,
|
336
357
|
*,
|
337
358
|
services: Union[Services, str] = Services(blob=True),
|
359
|
+
sts_hook: Optional[Callable[[str], None]] = None,
|
338
360
|
**kwargs: Any
|
339
361
|
) -> str:
|
340
362
|
"""Generates a shared access signature for the blob service.
|
@@ -376,6 +398,10 @@ def generate_account_sas(
|
|
376
398
|
Specifies the protocol permitted for a request made. The default value is https.
|
377
399
|
:keyword str encryption_scope:
|
378
400
|
Specifies the encryption scope for a request made so that all write operations will be service encrypted.
|
401
|
+
:keyword sts_hook:
|
402
|
+
For debugging purposes only. If provided, the hook is called with the string to sign
|
403
|
+
that was used to generate the SAS.
|
404
|
+
:paramtype sts_hook: Optional[Callable[[str], None]]
|
379
405
|
:return: A Shared Access Signature (sas) token.
|
380
406
|
:rtype: str
|
381
407
|
|
@@ -396,6 +422,7 @@ def generate_account_sas(
|
|
396
422
|
expiry=expiry,
|
397
423
|
start=start,
|
398
424
|
ip=ip,
|
425
|
+
sts_hook=sts_hook,
|
399
426
|
**kwargs
|
400
427
|
)
|
401
428
|
|
@@ -410,6 +437,8 @@ def generate_container_sas(
|
|
410
437
|
start: Optional[Union["datetime", str]] = None,
|
411
438
|
policy_id: Optional[str] = None,
|
412
439
|
ip: Optional[str] = None,
|
440
|
+
*,
|
441
|
+
sts_hook: Optional[Callable[[str], None]] = None,
|
413
442
|
**kwargs: Any
|
414
443
|
) -> str:
|
415
444
|
"""Generates a shared access signature for a container.
|
@@ -483,6 +512,10 @@ def generate_container_sas(
|
|
483
512
|
:keyword str correlation_id:
|
484
513
|
The correlation id to correlate the storage audit logs with the audit logs used by the principal
|
485
514
|
generating and distributing the SAS. This can only be used when generating a SAS with delegation key.
|
515
|
+
:keyword sts_hook:
|
516
|
+
For debugging purposes only. If provided, the hook is called with the string to sign
|
517
|
+
that was used to generate the SAS.
|
518
|
+
:paramtype sts_hook: Optional[Callable[[str], None]]
|
486
519
|
:return: A Shared Access Signature (sas) token.
|
487
520
|
:rtype: str
|
488
521
|
|
@@ -515,6 +548,7 @@ def generate_container_sas(
|
|
515
548
|
start=start,
|
516
549
|
policy_id=policy_id,
|
517
550
|
ip=ip,
|
551
|
+
sts_hook=sts_hook,
|
518
552
|
**kwargs
|
519
553
|
)
|
520
554
|
|
@@ -531,6 +565,8 @@ def generate_blob_sas(
|
|
531
565
|
start: Optional[Union["datetime", str]] = None,
|
532
566
|
policy_id: Optional[str] = None,
|
533
567
|
ip: Optional[str] = None,
|
568
|
+
*,
|
569
|
+
sts_hook: Optional[Callable[[str], None]] = None,
|
534
570
|
**kwargs: Any
|
535
571
|
) -> str:
|
536
572
|
"""Generates a shared access signature for a blob.
|
@@ -616,6 +652,10 @@ def generate_blob_sas(
|
|
616
652
|
:keyword str correlation_id:
|
617
653
|
The correlation id to correlate the storage audit logs with the audit logs used by the principal
|
618
654
|
generating and distributing the SAS. This can only be used when generating a SAS with delegation key.
|
655
|
+
:keyword sts_hook:
|
656
|
+
For debugging purposes only. If provided, the hook is called with the string to sign
|
657
|
+
that was used to generate the SAS.
|
658
|
+
:paramtype sts_hook: Optional[Callable[[str], None]]
|
619
659
|
:return: A Shared Access Signature (sas) token.
|
620
660
|
:rtype: str
|
621
661
|
"""
|
@@ -645,6 +685,7 @@ def generate_blob_sas(
|
|
645
685
|
start=start,
|
646
686
|
policy_id=policy_id,
|
647
687
|
ip=ip,
|
688
|
+
sts_hook=sts_hook,
|
648
689
|
**kwargs
|
649
690
|
)
|
650
691
|
|
azure/storage/blob/_version.py
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: azure-storage-blob
|
3
|
-
Version: 12.
|
3
|
+
Version: 12.23.0b1
|
4
4
|
Summary: Microsoft Azure Blob Storage Client Library for Python
|
5
5
|
Home-page: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
6
6
|
Author: Microsoft Corporation
|
7
7
|
Author-email: ascl@microsoft.com
|
8
8
|
License: MIT License
|
9
9
|
Keywords: azure,azure sdk
|
10
|
-
Classifier: Development Status ::
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
11
11
|
Classifier: Programming Language :: Python
|
12
12
|
Classifier: Programming Language :: Python :: 3 :: Only
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
@@ -20,12 +20,12 @@ Classifier: License :: OSI Approved :: MIT License
|
|
20
20
|
Requires-Python: >=3.8
|
21
21
|
Description-Content-Type: text/markdown
|
22
22
|
License-File: LICENSE
|
23
|
-
Requires-Dist: azure-core >=1.
|
23
|
+
Requires-Dist: azure-core >=1.30.0
|
24
24
|
Requires-Dist: cryptography >=2.1.4
|
25
25
|
Requires-Dist: typing-extensions >=4.6.0
|
26
26
|
Requires-Dist: isodate >=0.6.1
|
27
27
|
Provides-Extra: aio
|
28
|
-
Requires-Dist: azure-core[aio] >=1.
|
28
|
+
Requires-Dist: azure-core[aio] >=1.30.0 ; extra == 'aio'
|
29
29
|
|
30
30
|
# Azure Storage Blobs client library for Python
|
31
31
|
Azure Blob storage is Microsoft's object storage solution for the cloud. Blob storage is optimized for storing massive amounts of unstructured data, such as text or binary data.
|
@@ -12,10 +12,10 @@ azure/storage/blob/_lease.py,sha256=ReF0nVfZE8p_clUGpebZPprBdXJ7lOGEqXmJUhvsX5U,
|
|
12
12
|
azure/storage/blob/_list_blobs_helper.py,sha256=smnTcpGSVkk93G0RI7YczhkIM0s0gx4bSGWj_DB8t_s,13160
|
13
13
|
azure/storage/blob/_models.py,sha256=c01JsL1fCAWecXfUUD6Dn50qpjV9r5ZiViXXCwNZVN4,66018
|
14
14
|
azure/storage/blob/_quick_query_helper.py,sha256=HO6ufvSEWQSaFJ4CanujE4IN7FYB6y1f8PU0-dItMsk,6663
|
15
|
-
azure/storage/blob/_serialize.py,sha256=
|
16
|
-
azure/storage/blob/_shared_access_signature.py,sha256=
|
15
|
+
azure/storage/blob/_serialize.py,sha256=5_MsQx2hVJnhNqlxP6_O7rksxEoGJXXSJSG3WIUd-iw,8146
|
16
|
+
azure/storage/blob/_shared_access_signature.py,sha256=VkoKyo5apDnKQ8wuEBp1C6MaKlqDHAZOf5wlqRcqdOA,35354
|
17
17
|
azure/storage/blob/_upload_helpers.py,sha256=-ZpqzST-wFdWqCm_I4oWGLTMQ5N0aYb3RHxaMvmf9Q4,14688
|
18
|
-
azure/storage/blob/_version.py,sha256=
|
18
|
+
azure/storage/blob/_version.py,sha256=Q6fsDbychx6wPqxZrmiA442MB6e6EId7rWNDbWmnhlg,333
|
19
19
|
azure/storage/blob/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
20
|
azure/storage/blob/_generated/__init__.py,sha256=J2H2yiFhRSsMCNKUI7gaYFIQ4_AAbWjPtzXdOsHFQFI,835
|
21
21
|
azure/storage/blob/_generated/_azure_blob_storage.py,sha256=Xpt7ZrX5n2nN0l5x8EU9tX8H1ZPaK0vOV0GEFNxhYxs,5716
|
@@ -59,7 +59,7 @@ azure/storage/blob/_shared/policies.py,sha256=XuoVxFgyXd2-6h-rniGlvUU4-y0SpsjMdw
|
|
59
59
|
azure/storage/blob/_shared/policies_async.py,sha256=aVLOV8mugAI7K2rWaaBbUkXd_UCfsw9DH08gZtfLp2A,12713
|
60
60
|
azure/storage/blob/_shared/request_handlers.py,sha256=0G9eyzMY_8BlLfHA6jbJF75ENcu3xqZ33bHfSRi9HTM,9755
|
61
61
|
azure/storage/blob/_shared/response_handlers.py,sha256=wqZ1hGRDTwh3GkRB0gPSjgm_7TP2quZc_ex4pYThW-8,9190
|
62
|
-
azure/storage/blob/_shared/shared_access_signature.py,sha256=
|
62
|
+
azure/storage/blob/_shared/shared_access_signature.py,sha256=ov8h9CStKwlfZBtlj54jeckpzuVjYcYvJNKgxQByZ9o,11130
|
63
63
|
azure/storage/blob/_shared/uploads.py,sha256=O7V-gxxnBozcNscQFzH_V9ZJv6i3Y_QXJePL0g9X3Io,22157
|
64
64
|
azure/storage/blob/_shared/uploads_async.py,sha256=ZFlwMgZIY2cYDzuhgVt0XCQV4ZtRI3PLi_A5cKTd0rw,16782
|
65
65
|
azure/storage/blob/_shared/avro/__init__.py,sha256=Ch-mWS2_vgonM9LjVaETdaW51OL6LfG23X-0tH2AFjw,310
|
@@ -78,8 +78,8 @@ azure/storage/blob/aio/_lease_async.py,sha256=dy4_KZYuIhlxEvYO4GLTKdZz4UzFkpxcm7
|
|
78
78
|
azure/storage/blob/aio/_list_blobs_helper.py,sha256=cbrJcaGVfOvVCcLYd5dGx-jV3JjSvKfDIi2AQjf79qs,9920
|
79
79
|
azure/storage/blob/aio/_models.py,sha256=fdv7OQc6utrGBIS8FSNuBhYK5Q65o1TbKvdeeQaeUOc,8143
|
80
80
|
azure/storage/blob/aio/_upload_helpers.py,sha256=zROsVN6PK2Cn59Ysq08Ide5T1IGG2yH7oK9ZCn5uQXs,14038
|
81
|
-
azure_storage_blob-12.
|
82
|
-
azure_storage_blob-12.
|
83
|
-
azure_storage_blob-12.
|
84
|
-
azure_storage_blob-12.
|
85
|
-
azure_storage_blob-12.
|
81
|
+
azure_storage_blob-12.23.0b1.dist-info/LICENSE,sha256=_VMkgdgo4ToLE8y1mOAjOKNhd0BnWoYu5r3BVBto6T0,1073
|
82
|
+
azure_storage_blob-12.23.0b1.dist-info/METADATA,sha256=tgrAaS4hQ05OXzOYADD8yCJ-DyR-vgnLBkoszoX2z8c,26241
|
83
|
+
azure_storage_blob-12.23.0b1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
84
|
+
azure_storage_blob-12.23.0b1.dist-info/top_level.txt,sha256=S7DhWV9m80TBzAhOFjxDUiNbKszzoThbnrSz5MpbHSQ,6
|
85
|
+
azure_storage_blob-12.23.0b1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{azure_storage_blob-12.22.0.dist-info → azure_storage_blob-12.23.0b1.dist-info}/top_level.txt
RENAMED
File without changes
|