Skip to content

Commit 33811df

Browse files
committed
Merge branch 'EnergyID-master'
2 parents fca22a2 + 16b543a commit 33811df

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@
55
*~
66
.DS_Store
77
Thumbs.db
8+
9+
#pycharm
10+
.idea/*

azure_storage_logging/handlers.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
from tempfile import mkstemp
2323
from zipfile import ZIP_DEFLATED, ZipFile
2424

25-
from azure.storage.blob import BlobService
25+
from azure.storage.blob import BlockBlobService
26+
from azure.storage.blob.models import ContentSettings
2627
from azure.storage.queue import QueueService
2728
from azure.storage.table import TableService
2829

@@ -48,7 +49,7 @@ def __init__(self,
4849
max_connections=1,
4950
max_retries=5,
5051
retry_wait=1.0):
51-
self.service = BlobService(account_name, account_key, protocol)
52+
self.service = BlockBlobService(account_name, account_key, protocol)
5253
self.container_created = False
5354
hostname = gethostname()
5455
self.meta = {'hostname': hostname.replace('_', '-'),
@@ -79,13 +80,12 @@ def put_file_into_storage(self, dirName, fileName):
7980
file_path = tmpfile_path
8081
else:
8182
suffix, content_type = '', 'text/plain'
82-
self.service.put_block_blob_from_path(self.container,
83-
fileName + suffix,
84-
file_path,
85-
x_ms_blob_content_type=content_type,
86-
max_connections=self.max_connections,
87-
max_retries=self.max_retries,
88-
retry_wait=self.retry_wait)
83+
self.service.create_blob_from_path(container_name=self.container,
84+
blob_name=fileName+suffix,
85+
file_path=fileName,
86+
content_settings=ContentSettings(content_type=content_type),
87+
max_connections=self.max_connections
88+
) # max_retries and retry_wait no longer arguments in azure 0.33
8989
finally:
9090
if self.zip_compression and fd:
9191
os.remove(tmpfile_path)

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
setup(
1919
name='azure-storage-logging',
20-
version='0.5.0',
20+
version='0.5.1',
2121
description='Logging handlers to send logs to Microsoft Azure Storage',
2222
long_description=open('README.rst').read(),
2323
author='Michiya Takahashi',
@@ -26,7 +26,7 @@
2626
license='Apache License 2.0',
2727
packages=['azure_storage_logging'],
2828
install_requires=[
29-
'azure-storage',
29+
'azure-storage>=0.33.0',
3030
],
3131
classifiers=CLASSIFIERS,
3232
keywords='azure logging',

0 commit comments

Comments
 (0)