Skip to content

Commit 22bebfe

Browse files
authored
Merge pull request #456 from Azure/dev
1.2.0rc1 release
2 parents ff76da6 + 2fd1bc1 commit 22bebfe

File tree

589 files changed

+40700
-33221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

589 files changed

+40700
-33221
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,7 @@ src/build
5959
.cache/
6060

6161
# virtual environments for testing generated by validate_packages.py
62-
py*test-*/*
62+
py*test-*/*
63+
64+
# pytest cache
65+
.pytest_cache/*

.travis.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@ matrix:
66
include:
77
- os: linux
88
python: "2.7"
9-
- os: linux
10-
python: "3.3"
119
- os: linux
1210
python: "3.4"
1311
- os: linux
1412
python: "3.5"
1513
- os: linux
1614
python: "3.6"
17-
- os: linux
18-
python: "nightly"
1915
- os: linux
2016
python: "pypy3.5-5.8.0"
2117
- os: osx
@@ -31,7 +27,7 @@ matrix:
3127
before_install:
3228
- if [[ -n "$TRAVIS_TAG" && "$TRAVIS_PYTHON_VERSION" != "3.6" ]]; then travis_terminate 0; fi; # Deploy on 3.6
3329
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
34-
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python3; fi
30+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew upgrade python; fi
3531
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then python3 -m venv venv; fi
3632
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then source venv/bin/activate; fi
3733
install:

azure-storage-blob/ChangeLog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
> See [BreakingChanges](BreakingChanges.md) for a detailed list of API breaks.
44
5+
## Version 1.2.0rc1:
6+
7+
- Support for 2017-11-09 REST version. Please see our REST API documentation and blog for information about the related added features.
8+
- Support for write-once read-many containers.
9+
- Added support for OAuth authentication for HTTPS requests(Please note that this feature is available in preview).
10+
511
## Version 1.1.0:
612

713
- Support for 2017-07-29 REST version. Please see our REST API documentation and blogs for information about the related added features.

azure-storage-blob/azure/storage/blob/_constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
# --------------------------------------------------------------------------
66

77
__author__ = 'Microsoft Corp. <[email protected]>'
8-
__version__ = '1.1.0'
8+
__version__ = '1.2.0rc1'
99

1010
# x-ms-version for storage service.
11-
X_MS_VERSION = '2017-07-29'
11+
X_MS_VERSION = '2017-11-09'
1212

1313
# internal configurations, should not be changed
1414
_LARGE_BLOB_UPLOAD_MAX_READ_BUFFER_SIZE = 4 * 1024 * 1024

azure-storage-blob/azure/storage/blob/_deserialization.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ def _convert_xml_to_containers(response):
165165
<LeaseState>available | leased | expired | breaking | broken</LeaseState>
166166
<LeaseDuration>infinite | fixed</LeaseDuration>
167167
<PublicAccess>blob | container</PublicAccess>
168+
<HasImmutabilityPolicy>true | false</HasImmutabilityPolicy>
169+
<HasLegalHold>true | false</HasLegalHold>
168170
</Properties>
169171
<Metadata>
170172
<metadata-name>value</metadata-name>
@@ -205,6 +207,8 @@ def _convert_xml_to_containers(response):
205207
container.properties.lease_state = properties_element.findtext('LeaseState')
206208
container.properties.lease_duration = properties_element.findtext('LeaseDuration')
207209
container.properties.public_access = properties_element.findtext('PublicAccess')
210+
container.properties.has_immutability_policy = properties_element.findtext('HasImmutabilityPolicy')
211+
container.properties.has_legal_hold = properties_element.findtext('HasLegalHold')
208212

209213
# Add container to list
210214
containers.append(container)
@@ -240,6 +244,7 @@ def _convert_xml_to_containers(response):
240244
'ArchiveStatus': (None, 'rehydration_status', _to_str),
241245
'DeletedTime': (None, 'deleted_time', parser.parse),
242246
'RemainingRetentionDays': (None, 'remaining_retention_days', _to_int),
247+
'Creation-Time': (None, 'creation_time', parser.parse),
243248
}
244249

245250

@@ -281,6 +286,7 @@ def _convert_xml_to_blob_list(response):
281286
<AccessTierInferred>true</AccessTierInferred>
282287
<DeletedTime>datetime</DeletedTime>
283288
<RemainingRetentionDays>int</RemainingRetentionDays>
289+
<Creation-Time>date-time-value</Creation-Time>
284290
</Properties>
285291
<Metadata>
286292
<Name>value</Name>

azure-storage-blob/azure/storage/blob/_upload_chunking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def _is_chunk_empty(self, chunk_data):
285285
# read until non-zero byte is encountered
286286
# if reached the end without returning, then chunk_data is all 0's
287287
for each_byte in chunk_data:
288-
if each_byte != 0:
288+
if each_byte != 0 and each_byte != b'\x00':
289289
return False
290290
return True
291291

azure-storage-blob/azure/storage/blob/appendblobservice.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ class AppendBlobService(BaseBlobService):
6868
'''
6969
MAX_BLOCK_SIZE = 4 * 1024 * 1024
7070

71-
def __init__(self, account_name=None, account_key=None, sas_token=None,
72-
is_emulated=False, protocol=DEFAULT_PROTOCOL, endpoint_suffix=SERVICE_HOST_BASE,
73-
custom_domain=None, request_session=None, connection_string=None, socket_timeout=None):
71+
def __init__(self, account_name=None, account_key=None, sas_token=None, is_emulated=False,
72+
protocol=DEFAULT_PROTOCOL, endpoint_suffix=SERVICE_HOST_BASE, custom_domain=None, request_session=None,
73+
connection_string=None, socket_timeout=None, token_credential=None):
7474
'''
7575
:param str account_name:
7676
The storage account name. This is used to authenticate requests
@@ -109,11 +109,15 @@ def __init__(self, account_name=None, account_key=None, sas_token=None,
109109
:param int socket_timeout:
110110
If specified, this will override the default socket timeout. The timeout specified is in seconds.
111111
See DEFAULT_SOCKET_TIMEOUT in _constants.py for the default value.
112+
:param token_credential:
113+
A token credential used to authenticate HTTPS requests. The token value
114+
should be updated before its expiration.
115+
:type `~azure.storage.common.TokenCredential`
112116
'''
113117
self.blob_type = _BlobTypes.AppendBlob
114118
super(AppendBlobService, self).__init__(
115119
account_name, account_key, sas_token, is_emulated, protocol, endpoint_suffix,
116-
custom_domain, request_session, connection_string, socket_timeout)
120+
custom_domain, request_session, connection_string, socket_timeout, token_credential)
117121

118122
def create_blob(self, container_name, blob_name, content_settings=None,
119123
metadata=None, lease_id=None,

azure-storage-blob/azure/storage/blob/baseblobservice.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ class BaseBlobService(StorageClient):
139139
MAX_SINGLE_GET_SIZE = 32 * 1024 * 1024
140140
MAX_CHUNK_GET_SIZE = 4 * 1024 * 1024
141141

142-
def __init__(self, account_name=None, account_key=None, sas_token=None,
143-
is_emulated=False, protocol=DEFAULT_PROTOCOL, endpoint_suffix=SERVICE_HOST_BASE,
144-
custom_domain=None, request_session=None, connection_string=None, socket_timeout=None):
142+
def __init__(self, account_name=None, account_key=None, sas_token=None, is_emulated=False,
143+
protocol=DEFAULT_PROTOCOL, endpoint_suffix=SERVICE_HOST_BASE, custom_domain=None, request_session=None,
144+
connection_string=None, socket_timeout=None, token_credential=None):
145145
'''
146146
:param str account_name:
147147
The storage account name. This is used to authenticate requests
@@ -180,12 +180,17 @@ def __init__(self, account_name=None, account_key=None, sas_token=None,
180180
:param int socket_timeout:
181181
If specified, this will override the default socket timeout. The timeout specified is in seconds.
182182
See DEFAULT_SOCKET_TIMEOUT in _constants.py for the default value.
183+
:param token_credential:
184+
A token credential used to authenticate HTTPS requests. The token value
185+
should be updated before its expiration.
186+
:type `~azure.storage.common.TokenCredential`
183187
'''
184188
service_params = _ServiceParameters.get_service_parameters(
185189
'blob',
186190
account_name=account_name,
187191
account_key=account_key,
188192
sas_token=sas_token,
193+
token_credential=token_credential,
189194
is_emulated=is_emulated,
190195
protocol=protocol,
191196
endpoint_suffix=endpoint_suffix,
@@ -204,6 +209,8 @@ def __init__(self, account_name=None, account_key=None, sas_token=None,
204209
)
205210
elif self.sas_token:
206211
self.authentication = _StorageSASAuthentication(self.sas_token)
212+
elif self.token_credential:
213+
self.authentication = self.token_credential
207214
else:
208215
self.authentication = _StorageNoAuthentication()
209216

azure-storage-blob/azure/storage/blob/blockblobservice.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ class BlockBlobService(BaseBlobService):
9393
MAX_BLOCK_SIZE = 4 * 1024 * 1024
9494
MIN_LARGE_BLOCK_UPLOAD_THRESHOLD = 4 * 1024 * 1024 + 1
9595

96-
def __init__(self, account_name=None, account_key=None, sas_token=None,
97-
is_emulated=False, protocol=DEFAULT_PROTOCOL, endpoint_suffix=SERVICE_HOST_BASE,
98-
custom_domain=None, request_session=None, connection_string=None, socket_timeout=None):
96+
def __init__(self, account_name=None, account_key=None, sas_token=None, is_emulated=False,
97+
protocol=DEFAULT_PROTOCOL, endpoint_suffix=SERVICE_HOST_BASE, custom_domain=None,
98+
request_session=None, connection_string=None, socket_timeout=None, token_credential=None):
9999
'''
100100
:param str account_name:
101101
The storage account name. This is used to authenticate requests
@@ -134,11 +134,15 @@ def __init__(self, account_name=None, account_key=None, sas_token=None,
134134
:param int socket_timeout:
135135
If specified, this will override the default socket timeout. The timeout specified is in seconds.
136136
See DEFAULT_SOCKET_TIMEOUT in _constants.py for the default value.
137+
:param token_credential:
138+
A token credential used to authenticate HTTPS requests. The token value
139+
should be updated before its expiration.
140+
:type `~azure.storage.common.TokenCredential`
137141
'''
138142
self.blob_type = _BlobTypes.BlockBlob
139143
super(BlockBlobService, self).__init__(
140144
account_name, account_key, sas_token, is_emulated, protocol, endpoint_suffix,
141-
custom_domain, request_session, connection_string, socket_timeout)
145+
custom_domain, request_session, connection_string, socket_timeout, token_credential)
142146

143147
def put_block(self, container_name, blob_name, block, block_id,
144148
validate_content=False, lease_id=None, timeout=None):

azure-storage-blob/azure/storage/blob/models.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,19 @@ class ContainerProperties(object):
3939
conditionally.
4040
:ivar LeaseProperties lease:
4141
Stores all the lease information for the container.
42+
:ivar bool has_immutability_policy:
43+
Represents whether the container has an immutability policy.
44+
:ivar bool has_legal_hold:
45+
Represents whether the container has a legal hold.
4246
'''
4347

4448
def __init__(self):
4549
self.last_modified = None
4650
self.etag = None
4751
self.lease = LeaseProperties()
4852
self.public_access = None
53+
self.has_immutability_policy = None
54+
self.has_legal_hold = None
4955

5056

5157
class Blob(object):
@@ -128,6 +134,8 @@ class BlobProperties(object):
128134
A datetime object representing the time at which the blob was deleted.
129135
:ivar int remaining_retention_days:
130136
The number of days that the blob will be retained before being permanently deleted by the service.
137+
:ivar datetime creation_time:
138+
Indicates when the blob was created, in UTC.
131139
'''
132140

133141
def __init__(self):
@@ -147,6 +155,7 @@ def __init__(self):
147155
self.blob_tier_inferred = False
148156
self.deleted_time = None
149157
self.remaining_retention_days = None
158+
self.creation_time = None
150159

151160

152161
class ContentSettings(object):

0 commit comments

Comments
 (0)