Skip to main content

Microsoft Azure Storage Common Client Library for Python

Project description

Microsoft Azure Storage SDK for Python

https://travis-ci.org/Azure/azure-storage-python.svg https://img.shields.io/codecov/c/github/azure/azure-storage-python.svg

This project provides a client library in Python that makes it easy to consume Microsoft Azure Storage services. For documentation please see the Microsoft Azure Python Developer Center and our API Reference (also available on readthedocs).

If you are looking for the Service Bus or Azure Management libraries, please visit https://github.com/Azure/azure-sdk-for-python.

Compatibility

IMPORTANT: If you have an earlier version of the azure package (version < 1.0), you should uninstall it before installing this package.

You can check the version using pip:

pip freeze

If you see azure==0.11.0 (or any version below 1.0), uninstall it first then install it again:

pip uninstall azure
pip install azure

If you are upgrading from a version older than 0.30.0, see the upgrade doc, the usage samples in the samples directory, and the ChangeLog and BreakingChanges.

If you are encountering problems installing azure storage on Azure Web Apps, upgrading pip might help.

IMPORTANT: If you have an earlier version of the azure-storage package (version <= 0.36.0), you should uninstall it before installing the new split packages.

You can check the version using pip:

pip freeze

If you see azure-storage==0.36.0 (or any version below 0.36.0), uninstall it first:

pip uninstall azure-storage

Features

  • Blob

    • Create/Read/Update/Delete Containers

    • Create/Read/Update/Delete Blobs

    • Advanced Blob Operations

  • Queue

    • Create/Delete Queues

    • Insert/Peek Queue Messages

    • Advanced Queue Operations

  • Files

    • Create/Update/Delete Shares

    • Create/Update/Delete Directories

    • Create/Read/Update/Delete Files

    • Advanced File Operations

Getting Started

Download

The Azure Storage SDK for Python is composed of 5 packages:

  • azure-storage-blob

    • Contains the blob service APIs.

  • azure-storage-file

    • Contains the file service APIs.

  • azure-storage-queue

    • Contains the queue service APIs.

  • azure-storage-common

    • Contains common code shared by blob, file and queue.

  • azure-storage-nspkg

    • Owns the azure.storage namespace, user should not use this directly.

Note: prior to and including version 0.36.0, there used to be a single package (azure-storage) containing all services. It is no longer supported, and users should install the 3 before-mentioned service packages individually, depending on the need. In addition, the table package is no longer releasing under the azure-storage namespace, please refer to cosmosdb.

Option 1: Via PyPi

To install via the Python Package Index (PyPI), type:

pip install azure-storage-blob
pip install azure-storage-file
pip install azure-storage-queue

Option 2: Source Via Git

To get the source code of the SDK via git just type:

git clone git://github.com/Azure/azure-storage-python.git

cd ./azure-storage-python/azure-storage-nspkg
python setup.py install

cd ../azure-storage-common
python setup.py install

cd ../azure-storage-blob
python setup.py install

Replace azure-storage-blob with azure-storage-file or azure-storage-queue, to install the other services.

Option 3: Source Zip

Download a zip of the code via GitHub or PyPi. Then follow the same instructions in option 2.

Minimum Requirements

  • Python 2.7, 3.3, 3.4, 3.5, or 3.6.

  • See setup.py for dependencies

Usage

To use this SDK to call Microsoft Azure storage services, you need to first create an account.

Logging

To make debugging easier, it is recommended to turn on logging for the logger named ‘azure.storage’. Here are two example configurations:

# Basic configuration: configure the root logger, including 'azure.storage'
logging.basicConfig(format='%(asctime)s %(name)-20s %(levelname)-5s %(message)s', level=logging.INFO)
# More advanced configuration allowing more control
logger = logging.getLogger('azure.storage')
handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s %(name)-20s %(levelname)-5s %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.setLevel(logging.INFO)

Here is how we use the logging levels, it is recommended to use INFO:

  • DEBUG: log strings to sign

  • INFO: log outgoing requests and responses, as well as retry attempts

  • WARNING: not used

  • ERROR: log calls that still failed after all the retries

Code Sample

See the samples directory for blob, queue, and file usage samples.

Need Help?

Be sure to check out the Microsoft Azure Developer Forums on MSDN or the Developer Forums on Stack Overflow if you have trouble with the provided code.

Contribute Code or Provide Feedback

If you would like to become an active contributor to this project, please follow the instructions provided in Azure Projects Contribution Guidelines. You can find more details for contributing in the CONTRIBUTING.md doc.

If you encounter any bugs with the library, please file an issue in the Issues section of the project.

Learn More

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azure-storage-common-2.1.0.tar.gz (41.9 kB view details)

Uploaded Source

Built Distribution

azure_storage_common-2.1.0-py2.py3-none-any.whl (47.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file azure-storage-common-2.1.0.tar.gz.

File metadata

  • Download URL: azure-storage-common-2.1.0.tar.gz
  • Upload date:
  • Size: 41.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for azure-storage-common-2.1.0.tar.gz
Algorithm Hash digest
SHA256 ccedef5c67227bc4d6670ffd37cec18fb529a1b7c3a5e53e4096eb0cf23dc73f
MD5 8b78fae1786098193ce21ddea0bf0157
BLAKE2b-256 4812e074fe454bc327fbe2a61e20d3260473ee4a0fd85387baf249dc83c8e774

See more details on using hashes here.

File details

Details for the file azure_storage_common-2.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: azure_storage_common-2.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 47.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for azure_storage_common-2.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b01a491a18839b9d05a4fe3421458a0ddb5ab9443c14e487f40d16f9a1dc2fbe
MD5 2a1bc3a3c9d804497df3e46f5e6fb07f
BLAKE2b-256 6ba06794b318ce0118d1a4053bdf0149a60807407db9b710354f2b203c2f5975

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page