Skip to content

Commit

Permalink
[storage] Async error message (#6701)
Browse files Browse the repository at this point in the history
* Fix for queue models

* Fix for queue models (#6681)

* Docs cleanups

* [storage] Readme tweaks (#6697)

* Fix for queue models

* Docs cleanups

* Better async import error
  • Loading branch information
annatisch authored Aug 6, 2019
1 parent 9865596 commit e3e68da
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 12 deletions.
5 changes: 4 additions & 1 deletion sdk/storage/azure-storage-blob/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
**Dependency updates**
- Adopted [azure-core](https://pypi.org/project/azure-core/) 1.0.0b2
- If you later want to revert to azure-storage-blob 12.0.0b1, or another Azure SDK
library requiring azure-core 1.0.0b1, you'll need to `pip uninstall azure-core`
library requiring azure-core 1.0.0b1, you must explicitly install azure-core
1.0.0b1 as well. For example:

`pip install azure-core==1.0.0b1 azure-storage-blob==12.0.0b1`

**Fixes and improvements**
- Fix for SAS URL encoding (#6500)
Expand Down
3 changes: 2 additions & 1 deletion sdk/storage/azure-storage-blob/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ from azure.storage.blob import BlobClient
blob = BlobClient.from_connection_string("my_connection_string", container="mycontainer", blob="my_blob")

with open("./BlockDestination.txt", "wb") as my_blob:
my_blob.writelines(blob.download_blob())
blob_data = blob.download_blob()
my_blob.writelines(blob_data.content_as_bytes())
```

### Enumerating blobs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ def _create_pipeline(self, credential, **kwargs):
if 'connection_timeout' not in kwargs:
kwargs['connection_timeout'] = DEFAULT_SOCKET_TIMEOUT[0] # type: ignore
if not config.transport:
from azure.core.pipeline.transport import AioHttpTransport
try:
from azure.core.pipeline.transport import AioHttpTransport
except ImportError:
raise ImportError("Unable to create async transport. Please check aiohttp is installed.")
config.transport = AioHttpTransport(**kwargs)
policies = [
QueueMessagePolicy(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ def setUp(self):
self.source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE)

blob = self.bsc.get_blob_client(self.container_name, self.source_blob_name)
if not self.is_playback():
self.bsc.create_container(self.container_name)
blob.upload_blob(self.source_blob_data)

# generate a SAS so that it is accessible with a URL
sas_token = blob.generate_shared_access_signature(
Expand Down
5 changes: 4 additions & 1 deletion sdk/storage/azure-storage-file/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
**Dependency updates**
- Adopted [azure-core](https://pypi.org/project/azure-core/) 1.0.0b2
- If you later want to revert to azure-storage-file 12.0.0b1, or another Azure SDK
library requiring azure-core 1.0.0b1, you'll need to `pip uninstall azure-core`
library requiring azure-core 1.0.0b1, you must explicitly install azure-core
1.0.0b1 as well. For example:

`pip install azure-core==1.0.0b1 azure-storage-file==12.0.0b1`

**Fixes and improvements**
- Fix for closing file handles - continuation token was not being passed to subsequent calls.
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/azure-storage-file/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ Upload a file to the share
```python
from azure.storage.file import FileClient

file = FileClient.from_connection_string("my_connection_string", share="share", file_path="myfile")
file_client = FileClient.from_connection_string("my_connection_string", share="share", file_path="myfile")

with open("./SampleSource.txt", "rb") as source_file:
file.upload_file(source_file)
file_client.upload_file(source_file)
```

## Troubleshooting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ def _create_pipeline(self, credential, **kwargs):
if 'connection_timeout' not in kwargs:
kwargs['connection_timeout'] = DEFAULT_SOCKET_TIMEOUT[0] # type: ignore
if not config.transport:
from azure.core.pipeline.transport import AioHttpTransport
try:
from azure.core.pipeline.transport import AioHttpTransport
except ImportError:
raise ImportError("Unable to create async transport. Please check aiohttp is installed.")
config.transport = AioHttpTransport(**kwargs)
policies = [
QueueMessagePolicy(),
Expand Down
5 changes: 4 additions & 1 deletion sdk/storage/azure-storage-queue/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
**Dependency updates**
- Adopted [azure-core](https://pypi.org/project/azure-core/) 1.0.0b2
- If you later want to revert to azure-storage-queue 12.0.0b1, or another Azure SDK
library requiring azure-core 1.0.0b1, you'll need to `pip uninstall azure-core`
library requiring azure-core 1.0.0b1, you must explicitly install azure-core
1.0.0b1 as well. For example:

`pip install azure-core==1.0.0b1 azure-storage-queue==12.0.0b1`

**Fixes and improvements**
- General refactor of duplicate and shared code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ def _create_pipeline(self, credential, **kwargs):
if 'connection_timeout' not in kwargs:
kwargs['connection_timeout'] = DEFAULT_SOCKET_TIMEOUT[0] # type: ignore
if not config.transport:
from azure.core.pipeline.transport import AioHttpTransport
try:
from azure.core.pipeline.transport import AioHttpTransport
except ImportError:
raise ImportError("Unable to create async transport. Please check aiohttp is installed.")
config.transport = AioHttpTransport(**kwargs)
policies = [
QueueMessagePolicy(),
Expand Down

0 comments on commit e3e68da

Please sign in to comment.