Skip to content

Commit

Permalink
Removed OAUTH_STORAGE_ACCOUNT from tests and fixed recordings
Browse files Browse the repository at this point in the history
  • Loading branch information
zezha-msft committed Aug 2, 2019
1 parent ba4355f commit 055de16
Show file tree
Hide file tree
Showing 40 changed files with 1,001 additions and 2,381 deletions.
1 change: 1 addition & 0 deletions azure-storage-blob/azure/storage/blob/__init__.py
Expand Up @@ -31,6 +31,7 @@
BatchSetBlobTierSubRequest,
BatchSubResponse,
CustomerProvidedEncryptionKey,
RehydratePriority,
)
from .pageblobservice import PageBlobService
from ._constants import __version__
6 changes: 3 additions & 3 deletions azure-storage-blob/azure/storage/blob/appendblobservice.py
Expand Up @@ -124,7 +124,7 @@ def __init__(self, account_name=None, account_key=None, sas_token=None, is_emula
def create_blob(self, container_name, blob_name, content_settings=None,
metadata=None, lease_id=None,
if_modified_since=None, if_unmodified_since=None,
if_match=None, if_none_match=None, cpk=None, timeout=None):
if_match=None, if_none_match=None, timeout=None, cpk=None):
'''
Creates a blob or overrides an existing blob. Use if_none_match=* to
prevent overriding an existing blob.
Expand Down Expand Up @@ -204,7 +204,7 @@ def append_block(self, container_name, blob_name, block,
appendpos_condition=None,
lease_id=None, if_modified_since=None,
if_unmodified_since=None, if_match=None,
if_none_match=None, cpk=None, timeout=None):
if_none_match=None, timeout=None, cpk=None):
'''
Commits a new block of data to the end of an existing append blob.
Expand Down Expand Up @@ -306,7 +306,7 @@ def append_block_from_url(self, container_name, blob_name, copy_source_url, sour
source_if_none_match=None, maxsize_condition=None,
appendpos_condition=None, lease_id=None, if_modified_since=None,
if_unmodified_since=None, if_match=None,
if_none_match=None, cpk=None, timeout=None):
if_none_match=None, timeout=None, cpk=None):
"""
Creates a new block to be committed as part of a blob, where the contents are read from a source url.
Expand Down
31 changes: 15 additions & 16 deletions azure-storage-blob/azure/storage/blob/baseblobservice.py
Expand Up @@ -1586,7 +1586,7 @@ def get_blob_service_properties(self, timeout=None):
def get_blob_properties(
self, container_name, blob_name, snapshot=None, lease_id=None,
if_modified_since=None, if_unmodified_since=None, if_match=None,
if_none_match=None, cpk=None, timeout=None):
if_none_match=None, timeout=None, cpk=None):
'''
Returns all user-defined metadata, standard HTTP properties, and
system properties for the blob. It does not return the content of the blob.
Expand Down Expand Up @@ -1656,7 +1656,7 @@ def get_blob_properties(
def set_blob_properties(
self, container_name, blob_name, content_settings=None, lease_id=None,
if_modified_since=None, if_unmodified_since=None, if_match=None,
if_none_match=None, cpk=None, timeout=None):
if_none_match=None, timeout=None, cpk=None):
'''
Sets system properties on the blob. If one property is set for the
content_settings, all properties will be overriden.
Expand Down Expand Up @@ -1890,8 +1890,7 @@ def get_blob_to_path(
snapshot=None, start_range=None, end_range=None,
validate_content=False, progress_callback=None,
max_connections=2, lease_id=None, if_modified_since=None,
if_unmodified_since=None, if_match=None, if_none_match=None, cpk=None,
timeout=None):
if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None, cpk=None):
'''
Downloads a blob to a file path, with automatic chunking and progress
notifications. Returns an instance of :class:`~azure.storage.blob.models.Blob` with
Expand Down Expand Up @@ -2010,8 +2009,8 @@ def get_blob_to_path(
if_unmodified_since,
if_match,
if_none_match,
cpk,
timeout)
timeout=timeout,
cpk=cpk)

return blob

Expand All @@ -2020,7 +2019,7 @@ def get_blob_to_stream(
start_range=None, end_range=None, validate_content=False,
progress_callback=None, max_connections=2, lease_id=None,
if_modified_since=None, if_unmodified_since=None, if_match=None,
if_none_match=None, cpk=None, timeout=None):
if_none_match=None, timeout=None, cpk=None):

'''
Downloads a blob to a stream, with automatic chunking and progress
Expand Down Expand Up @@ -2257,7 +2256,7 @@ def get_blob_to_bytes(
start_range=None, end_range=None, validate_content=False,
progress_callback=None, max_connections=2, lease_id=None,
if_modified_since=None, if_unmodified_since=None, if_match=None,
if_none_match=None, cpk=None, timeout=None):
if_none_match=None, timeout=None, cpk=None):
'''
Downloads a blob as an array of bytes, with automatic chunking and
progress notifications. Returns an instance of :class:`~azure.storage.blob.models.Blob` with
Expand Down Expand Up @@ -2365,8 +2364,8 @@ def get_blob_to_bytes(
if_unmodified_since,
if_match,
if_none_match,
cpk,
timeout)
timeout=timeout,
cpk=cpk)

blob.content = stream.getvalue()
return blob
Expand All @@ -2376,7 +2375,7 @@ def get_blob_to_text(
start_range=None, end_range=None, validate_content=False,
progress_callback=None, max_connections=2, lease_id=None,
if_modified_since=None, if_unmodified_since=None, if_match=None,
if_none_match=None, cpk=None, timeout=None):
if_none_match=None, timeout=None, cpk=None):
'''
Downloads a blob as unicode text, with automatic chunking and progress
notifications. Returns an instance of :class:`~azure.storage.blob.models.Blob` with
Expand Down Expand Up @@ -2484,15 +2483,15 @@ def get_blob_to_text(
if_unmodified_since,
if_match,
if_none_match,
cpk,
timeout)
timeout=timeout,
cpk=cpk)
blob.content = blob.content.decode(encoding)
return blob

def get_blob_metadata(
self, container_name, blob_name, snapshot=None, lease_id=None,
if_modified_since=None, if_unmodified_since=None, if_match=None,
if_none_match=None, cpk=None, timeout=None):
if_none_match=None, timeout=None, cpk=None):
'''
Returns all user-defined metadata for the specified blob or snapshot.
Expand Down Expand Up @@ -2561,7 +2560,7 @@ def get_blob_metadata(
def set_blob_metadata(self, container_name, blob_name,
metadata=None, lease_id=None,
if_modified_since=None, if_unmodified_since=None,
if_match=None, if_none_match=None, cpk=None, timeout=None):
if_match=None, if_none_match=None, timeout=None, cpk=None):
'''
Sets user-defined metadata for the specified blob as one or more
name-value pairs.
Expand Down Expand Up @@ -3040,7 +3039,7 @@ def change_blob_lease(self, container_name, blob_name,
def snapshot_blob(self, container_name, blob_name,
metadata=None, if_modified_since=None,
if_unmodified_since=None, if_match=None,
if_none_match=None, lease_id=None, cpk=None, timeout=None):
if_none_match=None, lease_id=None, timeout=None, cpk=None):
'''
Creates a read-only snapshot of a blob.
Expand Down
132 changes: 46 additions & 86 deletions azure-storage-blob/azure/storage/blob/blockblobservice.py
Expand Up @@ -150,7 +150,7 @@ def __init__(self, account_name=None, account_key=None, sas_token=None, is_emula
custom_domain, request_session, connection_string, socket_timeout, token_credential)

def put_block(self, container_name, blob_name, block, block_id,
validate_content=False, lease_id=None, cpk=None, timeout=None):
validate_content=False, lease_id=None, timeout=None, cpk=None):
'''
Creates a new block to be committed as part of a blob.
Expand Down Expand Up @@ -198,8 +198,8 @@ def put_block(self, container_name, blob_name, block, block_id,
def put_block_list(
self, container_name, blob_name, block_list, content_settings=None,
metadata=None, validate_content=False, lease_id=None, if_modified_since=None,
if_unmodified_since=None, if_match=None, if_none_match=None, cpk=None,
timeout=None, standard_blob_tier=None):
if_unmodified_since=None, if_match=None, if_none_match=None,
timeout=None, standard_blob_tier=None, cpk=None):
'''
Writes a blob by specifying the list of block IDs that make up the blob.
In order to be written as part of a blob, a block must have been
Expand Down Expand Up @@ -336,7 +336,7 @@ def get_block_list(self, container_name, blob_name, snapshot=None,

def put_block_from_url(self, container_name, blob_name, copy_source_url, block_id,
source_range_start=None, source_range_end=None,
source_content_md5=None, lease_id=None, cpk=None, timeout=None):
source_content_md5=None, lease_id=None, timeout=None, cpk=None):
"""
Creates a new block to be committed as part of a blob.
Expand Down Expand Up @@ -401,11 +401,10 @@ def put_block_from_url(self, container_name, blob_name, copy_source_url, block_i

# ----Convenience APIs-----------------------------------------------------

def create_blob_from_path(
self, container_name, blob_name, file_path, content_settings=None,
metadata=None, validate_content=False, progress_callback=None,
max_connections=2, lease_id=None, if_modified_since=None,
if_unmodified_since=None, if_match=None, if_none_match=None, cpk=None, timeout=None, standard_blob_tier=None):
def create_blob_from_path(self, container_name, blob_name, file_path, content_settings=None, metadata=None,
validate_content=False, progress_callback=None, max_connections=2, lease_id=None,
if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None,
timeout=None, standard_blob_tier=None, cpk=None):
'''
Creates a new blob from a file path, or updates the content of an
existing blob, with automatic chunking and progress notifications.
Expand Down Expand Up @@ -482,31 +481,20 @@ def create_blob_from_path(

count = path.getsize(file_path)
with open(file_path, 'rb') as stream:
return self.create_blob_from_stream(
container_name=container_name,
blob_name=blob_name,
stream=stream,
count=count,
content_settings=content_settings,
metadata=metadata,
validate_content=validate_content,
lease_id=lease_id,
progress_callback=progress_callback,
max_connections=max_connections,
if_modified_since=if_modified_since,
if_unmodified_since=if_unmodified_since,
if_match=if_match,
if_none_match=if_none_match,
standard_blob_tier=standard_blob_tier,
cpk=cpk,
timeout=timeout)

def create_blob_from_stream(
self, container_name, blob_name, stream, count=None,
content_settings=None, metadata=None, validate_content=False,
progress_callback=None, max_connections=2, lease_id=None,
if_modified_since=None, if_unmodified_since=None, if_match=None,
if_none_match=None, cpk=None, timeout=None, use_byte_buffer=False, standard_blob_tier=None):
return self.create_blob_from_stream(container_name=container_name, blob_name=blob_name, stream=stream,
count=count, content_settings=content_settings, metadata=metadata,
validate_content=validate_content, progress_callback=progress_callback,
max_connections=max_connections, lease_id=lease_id,
if_modified_since=if_modified_since,
if_unmodified_since=if_unmodified_since, if_match=if_match,
if_none_match=if_none_match, timeout=timeout,
standard_blob_tier=standard_blob_tier, cpk=cpk)

def create_blob_from_stream(self, container_name, blob_name, stream, count=None, content_settings=None,
metadata=None, validate_content=False, progress_callback=None, max_connections=2,
lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None,
if_none_match=None, timeout=None, use_byte_buffer=False, standard_blob_tier=None,
cpk=None):
'''
Creates a new blob from a file/stream, or updates the content of
an existing blob, with automatic chunking and progress
Expand Down Expand Up @@ -712,12 +700,10 @@ def create_blob_from_stream(
cpk=cpk,
)

def create_blob_from_bytes(
self, container_name, blob_name, blob, index=0, count=None,
content_settings=None, metadata=None, validate_content=False,
progress_callback=None, max_connections=2, lease_id=None,
if_modified_since=None, if_unmodified_since=None, if_match=None,
if_none_match=None, cpk=None, timeout=None, standard_blob_tier=None):
def create_blob_from_bytes(self, container_name, blob_name, blob, index=0, count=None, content_settings=None,
metadata=None, validate_content=False, progress_callback=None, max_connections=2,
lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None,
if_none_match=None, timeout=None, standard_blob_tier=None, cpk=None):
'''
Creates a new blob from an array of bytes, or updates the content
of an existing blob, with automatic chunking and progress
Expand Down Expand Up @@ -807,33 +793,19 @@ def create_blob_from_bytes(
stream = BytesIO(blob)
stream.seek(index)

return self.create_blob_from_stream(
container_name=container_name,
blob_name=blob_name,
stream=stream,
count=count,
content_settings=content_settings,
metadata=metadata,
validate_content=validate_content,
progress_callback=progress_callback,
max_connections=max_connections,
lease_id=lease_id,
if_modified_since=if_modified_since,
if_unmodified_since=if_unmodified_since,
if_match=if_match,
if_none_match=if_none_match,
timeout=timeout,
use_byte_buffer=True,
standard_blob_tier=standard_blob_tier,
cpk=cpk,
)

def create_blob_from_text(
self, container_name, blob_name, text, encoding='utf-8',
content_settings=None, metadata=None, validate_content=False,
progress_callback=None, max_connections=2, lease_id=None,
if_modified_since=None, if_unmodified_since=None, if_match=None,
if_none_match=None, cpk=None, timeout=None, standard_blob_tier=None):
return self.create_blob_from_stream(container_name=container_name, blob_name=blob_name, stream=stream,
count=count, content_settings=content_settings, metadata=metadata,
validate_content=validate_content, progress_callback=progress_callback,
max_connections=max_connections, lease_id=lease_id,
if_modified_since=if_modified_since,
if_unmodified_since=if_unmodified_since, if_match=if_match,
if_none_match=if_none_match, timeout=timeout, use_byte_buffer=True,
standard_blob_tier=standard_blob_tier, cpk=cpk)

def create_blob_from_text(self, container_name, blob_name, text, encoding='utf-8', content_settings=None,
metadata=None, validate_content=False, progress_callback=None, max_connections=2,
lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None,
if_none_match=None, timeout=None, standard_blob_tier=None, cpk=None):
'''
Creates a new blob from str/unicode, or updates the content of an
existing blob, with automatic chunking and progress notifications.
Expand Down Expand Up @@ -912,25 +884,13 @@ def create_blob_from_text(
_validate_not_none('encoding', encoding)
text = text.encode(encoding)

return self.create_blob_from_bytes(
container_name=container_name,
blob_name=blob_name,
blob=text,
index=0,
count=len(text),
content_settings=content_settings,
metadata=metadata,
validate_content=validate_content,
lease_id=lease_id,
progress_callback=progress_callback,
max_connections=max_connections,
if_modified_since=if_modified_since,
if_unmodified_since=if_unmodified_since,
if_match=if_match,
if_none_match=if_none_match,
standard_blob_tier=standard_blob_tier,
cpk=cpk,
timeout=timeout)
return self.create_blob_from_bytes(container_name=container_name, blob_name=blob_name, blob=text, index=0,
count=len(text), content_settings=content_settings, metadata=metadata,
validate_content=validate_content, progress_callback=progress_callback,
max_connections=max_connections, lease_id=lease_id,
if_modified_since=if_modified_since, if_unmodified_since=if_unmodified_since,
if_match=if_match, if_none_match=if_none_match, timeout=timeout,
standard_blob_tier=standard_blob_tier, cpk=cpk)

def set_standard_blob_tier(
self, container_name, blob_name, standard_blob_tier, timeout=None, rehydrate_priority=None):
Expand Down
2 changes: 1 addition & 1 deletion azure-storage-blob/setup.py
Expand Up @@ -72,7 +72,7 @@
]),
install_requires=[
'azure-common>=1.1.5',
'azure-storage-common~=2.0'
'azure-storage-common~=2.1'
],
extras_require={
":python_version<'3.0'": ['futures'],
Expand Down
2 changes: 2 additions & 0 deletions azure-storage-file/azure/storage/file/__init__.py
Expand Up @@ -17,5 +17,7 @@
SharePermissions,
FilePermissions,
DeleteSnapshot,
SMBProperties,
NTFSAttributes,
)
from ._constants import __version__

0 comments on commit 055de16

Please sign in to comment.