# packages

pkgId: 19202989de21c045d3a66a221717a5dc0647a9a76bd1182e11d4bc381c9c82a7
name: python-azure-multiapi-storage
arch: src
version: 1.3.0
epoch: 0
release: 1
summary: Microsoft Azure Storage Client Library for Python with multi API version support.
url: https://github.com/Azure/azure-multiapi-storage-python
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-multiapi-storage-1.3.0-1.src.rpm
checksum_type: sha256
description:
  Handles multi-API versions of Azure Storage Data Plane originally from https://github.com/Azure/azure-storage-python.
  **NOTE:**
  - This is not an official Azure Storage SDK.
  - It is used by https://github.com/Azure/azure-cli to support multiple API versions.
  - The official Azure Storage SDK is at https://github.com/Azure/azure-storage-python.
  - The official Azure CosmosDB Table SDK is at https://github.com/Azure/azure-cosmosdb-python/tree/master/azure-cosmosdb-table.
  - **Please file issues at the appropriate repository above.**


pkgId: 65f94cdfe3d5dbdfcf4ead85ee945c83cc2ca270783ffc44ce82f5aa269a5437
name: python-azure-nspkg
arch: src
version: 3.0.2
epoch: 0
release: 1
summary: Microsoft Azure Namespace Package [Internal]
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-nspkg-3.0.2-1.src.rpm
checksum_type: sha256
description:
  This is the Microsoft Azure namespace package.
  This package is not intended to be installed directly by the end user.
  Since version 3.0, this is Python 2 package only, Python 3.x SDKs will use `PEP420 <https://www.python.org/dev/peps/pep-0420/>`__ as namespace package strategy.
  To avoid issues with package servers that does not support `python_requires`, a Python 3 package is installed but is empty.
  It provides the necessary files for other packages to extend the azure namespace.
  If you are looking to install the Azure client libraries, see the
  `azure <https://pypi.python.org/pypi/azure>`__ bundle package.


pkgId: 119ba614257d21c17d15acd01f7003c007a74dca182195b9f6606f2a062e8d5a
name: python-azure-purview-account
arch: src
version: 1.0.0b1
epoch: 0
release: 1
summary: Microsoft Azure Purview Account Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-purview-account-1.0.0b1-1.src.rpm
checksum_type: sha256
description:
  Azure Purview Account is a fully managed cloud service.

  **Please rely heavily on the [service's documentation][account_product_documentation] and our [client docs][request_builders_and_client] to use this library**

  [Source code][source_code] |  [Package (PyPI)][account_pypi] | [API reference documentation][account_ref_docs]| [Product documentation][account_product_documentation]





  - Python 2.7, or 3.6 or later is required to use this package.
  - You must have an [Azure subscription][azure_subscription] and a [Purview][purview_resource] to use this package.



  Follow [these][purview_resource] instructions to create your Purview resource



  Install the Azure Purview Account client library for Python with [pip][pip]:

  ```bash
  pip install azure-purview-account
  ```



  To use an [Azure Active Directory (AAD) token credential][authenticate_with_token],
  provide an instance of the desired credential type obtained from the
  [azure-identity][azure_identity_credentials] library.

  To authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip] and
  [enable AAD authentication on your Purview resource][enable_aad]

  After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use.
  As an example, [DefaultAzureCredential][default_azure_credential]
  can be used to authenticate the client:

  Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
  AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET

  Use the returned token credential to authenticate the client:

  ```python
  from azure.purview.account import PurviewAccountClient
  from azure.identity import DefaultAzureCredential

  credential = DefaultAzureCredential()
  client = PurviewAccountClient(endpoint="https://<my-account-name>.purview.azure.com", credential=credential)
  ```







  The following section shows you how to initialize and authenticate your client, then list all of your keys.

  - [Get Keys](#get-keys "Get All Keys")



  ```python
  from azure.purview.account import PurviewAccountClient
  from azure.identity import DefaultAzureCredential

  credential = DefaultAzureCredential()
  client = PurviewAccountClient(endpoint="https://<my-account-name>.purview.azure.com", credential=credential)
  response = client.accounts.get_access_keys()
  print(response)
  ```





  The Purview Account client will raise exceptions if status code of your responses is not defined.



  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` keyword argument:

  ```python
  import sys
  import logging
  from azure.identity import DefaultAzureCredential
  from azure.purview.account import PurviewAccountClient


  logger = logging.getLogger('azure')
  logger.setLevel(logging.DEBUG)


  handler = logging.StreamHandler(stream=sys.stdout)
  logger.addHandler(handler)

  endpoint = "https://<my-account-name>.purview.azure.com"
  credential = DefaultAzureCredential()


  client = PurviewAccountClient(endpoint=endpoint, credential=credential, logging_enable=True)
  ```

  Similarly, `logging_enable` can enable detailed logging for a single call,
  even when it isn't enabled for the client:

  ```python
  result = client.accounts.get_access_keys(logging_enable=True)
  ```



  For more generic samples, see our [client docs][request_builders_and_client].



  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->

  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/purview/
  [account_pypi]: https://pypi.org/project/azure-purview-catalog/#history
  [account_ref_docs]: https://azure.github.io/azure-sdk-for-python/
  [account_product_documentation]: https://azure.microsoft.com/services/purview/
  [azure_subscription]: https://azure.microsoft.com/free/
  [purview_resource]: https://docs.microsoft.com/azure/purview/create-catalog-portal
  [pip]: https://pypi.org/project/pip/
  [authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
  [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
  [azure_identity_pip]: https://pypi.org/project/azure-identity/
  [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
  [request_builders_and_client]: https://aka.ms/azsdk/python/protocol/quickstart
  [enable_aad]: https://docs.microsoft.com/azure/purview/create-catalog-portal#add-a-security-principal-to-a-data-plane-role
  [python_logging]: https://docs.python.org/3.5/library/logging.html
  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com






  - This is the initial release of the Azure Purview Account library.


pkgId: ccd04c348b1b1ff09759c6ba828e22464bc8048afe74e43037efe6d67a1d6cf4
name: python-azure-purview-administration
arch: src
version: 1.0.0b1
epoch: 0
release: 1
summary: Microsoft Azure Purview Administration Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-purview-administration-1.0.0b1-1.src.rpm
checksum_type: sha256
description:
  Azure Purview is a fully managed cloud service.

  **Please rely heavily on the [service's documentation][account_product_documentation] to use this library**

  [Source code][source_code] |  [Package (PyPI)][account_pypi] | [API reference documentation][account_ref_docs]| [Product documentation][account_product_documentation]



  _Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_





  - Python 2.7, or 3.6 or later is required to use this package.
  - You must have an [Azure subscription][azure_subscription] and a [Purview][purview_resource] to use this package.



  Follow [these][purview_resource] instructions to create your Purview resource



  Install the Azure Purview Account client library for Python with [pip][pip]:

  ```bash
  pip install azure-purview-administration
  ```



  To use an [Azure Active Directory (AAD) token credential][authenticate_with_token],
  provide an instance of the desired credential type obtained from the
  [azure-identity][azure_identity_credentials] library.

  To authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip] and
  [enable AAD authentication on your Purview resource][enable_aad]

  After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use.
  As an example, [DefaultAzureCredential][default_azure_credential]
  can be used to authenticate the client:

  Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
  AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET

  Use the returned token credential to authenticate the client:

  ```python
  from azure.purview.administration.account import PurviewAccountClient
  from azure.purview.administration.metadatapolicies import PurviewMetadataPoliciesClient
  from azure.identity import DefaultAzureCredential

  credential = DefaultAzureCredential()
  endpoint = "https://<my-account-name>.purview.azure.com"
  account_client = PurviewAccountClient(endpoint=endpoint, credential=credential)
  metadatapolicy_client = PurviewMetadataPoliciesClient(endpoint=endpoint, credential=credential)
  ```





  The package contains two kinds of client: `PurviewAccountClient` and `PurviewMetadataPoliciesClient`. You could use them
  with one package according to your requirements.



  The following section shows you how to initialize and authenticate your client, then list all of your keys.

  - [Get Keys](#get-keys "Get All Keys")



  ```python
  from azure.purview.administration.account import PurviewAccountClient
  from azure.identity import DefaultAzureCredential

  credential = DefaultAzureCredential()
  client = PurviewAccountClient(endpoint="https://<my-account-name>.purview.azure.com", credential=credential)
  response = client.accounts.get_access_keys()
  print(response)
  ```

  The following section shows you how to initialize and authenticate your client, then list all of your roles.

  - [List_Roles](#list-roles "List Roles")



  ```python
  from azure.purview.administration.metadatapolicies import PurviewMetadataPoliciesClient
  from azure.identity import DefaultAzureCredential

  credential = DefaultAzureCredential()
  client = PurviewMetadataPoliciesClient(endpoint="https://<my-account-name>.purview.azure.com", credential=credential)
  response = client.metadata_roles.list()
  result = [item for item in response]
  print(result)
  ```





  The Purview client will raise exceptions if status code of your responses is not defined.



  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` keyword argument:

  ```python
  import sys
  import logging
  from azure.identity import DefaultAzureCredential
  from azure.purview.administration.account import PurviewAccountClient


  logger = logging.getLogger('azure')
  logger.setLevel(logging.DEBUG)


  handler = logging.StreamHandler(stream=sys.stdout)
  logger.addHandler(handler)

  endpoint = "https://<my-account-name>.purview.azure.com"
  credential = DefaultAzureCredential()


  client = PurviewAccountClient(endpoint=endpoint, credential=credential, logging_enable=True)
  ```

  Similarly, `logging_enable` can enable detailed logging for a single call,
  even when it isn't enabled for the client:

  ```python
  result = client.accounts.get_access_keys(logging_enable=True)
  ```



  For more generic samples, see our [client docs][request_builders_and_client].



  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->

  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/purview/
  [account_pypi]: https://pypi.org/project/azure-purview-catalog/#history
  [account_ref_docs]: https://azure.github.io/azure-sdk-for-python/
  [account_product_documentation]: https://azure.microsoft.com/services/purview/
  [azure_subscription]: https://azure.microsoft.com/free/
  [purview_resource]: https://docs.microsoft.com/azure/purview/create-catalog-portal
  [pip]: https://pypi.org/project/pip/
  [authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
  [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
  [azure_identity_pip]: https://pypi.org/project/azure-identity/
  [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
  [enable_aad]: https://docs.microsoft.com/azure/purview/create-catalog-portal#add-a-security-principal-to-a-data-plane-role
  [python_logging]: https://docs.python.org/3.5/library/logging.html
  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com
  [request_builders_and_client]: https://aka.ms/azsdk/python/protocol/quickstart






  - This is the initial release of the Azure Purview Administration library.
  - This package includes the operations of `azure-purview-account` that was previously released


pkgId: 67759d41a0dac51b066d3a15a4e71371f57ca586091e5063b955875e8b4a932f
name: python-azure-purview-catalog
arch: src
version: 1.0.0b4
epoch: 0
release: 1
summary: Microsoft Azure Azure Purview Catalog Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-purview-catalog-1.0.0b4-1.src.rpm
checksum_type: sha256
description:
  Azure Purview Catalog is a fully managed cloud service whose users can discover the data sources they need and understand the data sources they find. At the same time, Data Catalog helps organizations get more value from their existing investments.

  - Search for data using technical or business terms
  - Browse associated technical, business, semantic, and operational metadata
  - Identify the sensitivity level of data.

  **Please rely heavily on the [service's documentation][catalog_product_documentation] and our [client docs][request_builders_and_client] to use this library**

  [Source code][source_code] | [Package (PyPI)][catalog_pypi] | [API reference documentation][catalog_ref_docs]| [Product documentation][catalog_product_documentation]



  _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_





  - Python 3.6 or later is required to use this package.
  - You must have an [Azure subscription][azure_subscription] and a [Purview][purview_resource] to use this package.



  Follow [these][purview_resource] instructions to create your Purview resource



  Install the Azure Purview Catalog client library for Python with [pip][pip]:

  ```bash
  pip install azure-purview-catalog
  ```



  To use an [Azure Active Directory (AAD) token credential][authenticate_with_token],
  provide an instance of the desired credential type obtained from the
  [azure-identity][azure_identity_credentials] library.

  To authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip] and
  [enable AAD authentication on your Purview resource][enable_aad]

  After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use.
  As an example, [DefaultAzureCredential][default_azure_credential]
  can be used to authenticate the client:

  Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
  AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET

  Use the returned token credential to authenticate the client:

  ```python
  from azure.purview.catalog import PurviewCatalogClient
  from azure.identity import DefaultAzureCredential

  credential = DefaultAzureCredential()
  client = PurviewCatalogClient(endpoint="https://<my-account-name>.purview.azure.com", credential=credential)
  ```





  This package offers request builders so you can build http requests and send these requests to the service using the `send_request` method.
  For more information on how to use request builders and our clients, see [here][request_builders_and_client].



  The following section shows you how to initialize and authenticate your client, then get all of your type-defs.

  - [Get All Type Definitions](#get-all-type-definitions "Get All Type Definitions")



  ```python
  from azure.purview.catalog import PurviewCatalogClient
  from azure.identity import DefaultAzureCredential
  from azure.core.exceptions import HttpResponseError

  credential = DefaultAzureCredential()
  client = PurviewCatalogClient(endpoint="https://<my-account-name>.purview.azure.com", credential=credential)
  try:
      response = client.types.get_all_type_definitions()
      
      print(response['entityDefs'])

  except HttpResponseError as e:
      print(e)
  ```





  The Purview Catalog client will raise exceptions defined in [Azure Core][azure_core] if you call `.raise_for_status()` on your responses.



  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` keyword argument:

  ```python
  import sys
  import logging
  from azure.identity import DefaultAzureCredential
  from azure.purview.catalog import PurviewCatalogClient


  logger = logging.getLogger('azure')
  logger.setLevel(logging.DEBUG)


  handler = logging.StreamHandler(stream=sys.stdout)
  logger.addHandler(handler)

  endpoint = "https://<my-account-name>.purview.azure.com"
  credential = DefaultAzureCredential()


  client = PurviewCatalogClient(endpoint=endpoint, credential=credential, logging_enable=True)
  ```

  Similarly, `logging_enable` can enable detailed logging for a single `send_request` call,
  even when it isn't enabled for the client:

  ```python
  result = client.types.get_all_type_definitions(logging_enable=True)
  ```



  For more generic samples, see our [client docs][request_builders_and_client].



  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->

  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/purview/azure-purview-catalog/azure/purview/catalog
  [catalog_pypi]: https://aka.ms/azsdk/python/purviewcatalog/pypi
  [catalog_ref_docs]: https://aka.ms/azsdk/python/purviewcatalog/ref-docs
  [catalog_product_documentation]: https://azure.microsoft.com/services/purview/
  [azure_subscription]: https://azure.microsoft.com/free/
  [purview_resource]: https://docs.microsoft.com/azure/purview/create-catalog-portal
  [pip]: https://pypi.org/project/pip/
  [authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
  [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
  [azure_identity_pip]: https://pypi.org/project/azure-identity/
  [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
  [request_builders_and_client]: https://aka.ms/azsdk/python/protocol/quickstart
  [enable_aad]: https://docs.microsoft.com/azure/purview/create-catalog-portal#add-a-security-principal-to-a-data-plane-role
  [azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [python_logging]: https://docs.python.org/3.5/library/logging.html
  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com







  **Features**

    - Support Atlas 2.2 APIs

  **Bugs Fixed**

    - Add missing query parameter `includeTermHierarchy` for update term API
    - Add missing query parameter `excludeRelationshipTypes` for get term API



  **Bugs Fixed**

    - Fix `delete_by_guids` to get rid of bad request error #22487



  **Features**

    - Add convenience operations to client

  **Breaking changes**

    - Remove rest layer and request builders(detailed description is in `README.md`)
    - The HttpRequest parameter to send_request has changed from `http_request` to `request`
    - Ordering of endpoint and credential params have changed




  - This is the initial release of the Azure Purview Catalog library.


pkgId: 20c4fad6fbf0768c662a09906c0dfc01d80a083ea62bfc48958b676ff44deab7
name: python-azure-purview-scanning
arch: src
version: 1.0.0b2
epoch: 0
release: 1
summary: Microsoft Azure Purview Scanning Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-purview-scanning-1.0.0b2-1.src.rpm
checksum_type: sha256
description:
  Azure Purview Scanning is a fully managed cloud service whose users can scan your data into your data estate (also known as your **catalog**). Scanning is a process by which the catalog connects directly to a data source on a user-specified schedule.

  - Scan your data into your catalog
  - Examine your data
  - Extract schemas from your data

  **Please rely heavily on the [service's documentation][scanning_product_documentation] and our [client docs][request_builders_and_client] to use this library**

  [Source code][source_code] | [Package (PyPI)][scanning_pypi] | [API reference documentation][scanning_ref_docs]| [Product documentation][scanning_product_documentation]



  _Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_





  - Python 2.7, or 3.6 or later is required to use this package.
  - You must have an [Azure subscription][azure_subscription] and a [Purview][purview_resource] to use this package.



  Follow [these][purview_resource] instructions to create your Purview resource



  Install the Azure Purview Scanning client library for Python with [pip][pip]:

  ```bash
  pip install azure-purview-scanning
  ```



  To use an [Azure Active Directory (AAD) token credential][authenticate_with_token],
  provide an instance of the desired credential type obtained from the
  [azure-identity][azure_identity_credentials] library.

  To authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip] and
  [enable AAD authentication on your Purview resource][enable_aad]

  After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use.
  As an example, [DefaultAzureCredential][default_azure_credential]
  can be used to authenticate the client:

  Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
  AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET

  Use the returned token credential to authenticate the client:

  ```python
  from azure.purview.scanning import PurviewScanningClient
  from azure.identity import DefaultAzureCredential

  credential = DefaultAzureCredential()
  client = PurviewScanningClient(endpoint="https://<my-account-name>.scan.purview.azure.com", credential=credential)
  ```





  This package offers request builders so you can build http requests and send these requests to the service using the `send_request` method.
  For more information on how to use request builders and our clients, see [here][request_builders_and_client].



  The following section shows you how to initialize and authenticate your client, then list all of your data sources.

  - [List All Data Sources](#list-all-data-sources "List All Data Sources")



  ```python
  from azure.purview.scanning import PurviewScanningClient
  from azure.identity import DefaultAzureCredential
  from azure.core.exceptions import HttpResponseError

  credential = DefaultAzureCredential()
  client = PurviewScanningClient(endpoint="https://<my-account-name>.scan.purview.azure.com", credential=credential)
  try:
      response = client.data_sources.list_all()
      result = [item for item in response]
      print(result)
  except HttpResponseError as e:
      print(e)
  ```





  The Purview Scanning client will raise exceptions defined in [Azure Core][azure_core] if you call `.raise_for_status()` on your responses.



  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` keyword argument:

  ```python
  import sys
  import logging
  from azure.identity import DefaultAzureCredential
  from azure.purview.scanning import PurviewScanningClient


  logger = logging.getLogger('azure')
  logger.setLevel(logging.DEBUG)


  handler = logging.StreamHandler(stream=sys.stdout)
  logger.addHandler(handler)

  endpoint = "https://<my-account-name>.scan.purview.azure.com"
  credential = DefaultAzureCredential()


  client = PurviewScanningClient(endpoint=endpoint, credential=credential, logging_enable=True)
  ```

  Similarly, `logging_enable` can enable detailed logging for a single `send_request` call,
  even when it isn't enabled for the client:

  ```python
  result = client.data_sources.list_all(logging_enable=True)
  ```



  For more generic samples, see our [client docs][request_builders_and_client].



  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->

  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/purview/azure-purview-scanning/azure/purview/scanning
  [scanning_pypi]: https://aka.ms/azsdk/python/purviewscanning/pypi
  [scanning_ref_docs]: https://aka.ms/azsdk/python/purviewscanning/ref-docs
  [scanning_product_documentation]: https://azure.microsoft.com/services/purview/
  [azure_subscription]: https://azure.microsoft.com/free/
  [purview_resource]: https://docs.microsoft.com/azure/purview/create-catalog-portal
  [pip]: https://pypi.org/project/pip/
  [authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
  [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
  [azure_identity_pip]: https://pypi.org/project/azure-identity/
  [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
  [request_builders_and_client]: https://aka.ms/azsdk/python/protocol/quickstart
  [enable_aad]: https://docs.microsoft.com/azure/purview/create-catalog-portal#add-a-security-principal-to-a-data-plane-role
  [python_logging]: https://docs.python.org/3.5/library/logging.html
  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com






  **Features**

    - Add convenience operations to client

  **Breaking changes**

    - Remove rest layer and request builders(detailed description is in `README.md`)
    - The HttpRequest parameter to send_request has changed from `http_request` to `request`
    - Ordering of endpoint and credential params have changed



  - This is the initial release of the Azure Purview Scanning library.


pkgId: de66c9db862cc1199a97308fe624103aaeb928499703cbd11c6f2102bdc06511
name: python-azure-purview-sharing
arch: src
version: 1.0.0b3
epoch: 0
release: 1
summary: Microsoft Azure Purview Sharing Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-purview-sharing-1.0.0b3-1.src.rpm
checksum_type: sha256
description:
  Microsoft Purview Share is a fully managed cloud service.

  **Please rely heavily on the [service's documentation][sharing_product_documentation] and our [protocol client docs][request_builders_and_client] to use this library**

  [Source code][source_code] | [Package (PyPI)][client_pypi_package] | [Product documentation][sharing_product_documentation]





  Install the Azure Purview Sharing client library for Python with [pip][pip]:

  ```bash
  pip install azure-purview-sharing
  ```



  - You must have an [Azure subscription][azure_subscription] and a [Purview resource][purview_resource] to use this package.
  - Python 3.6 or later is required to use this package.





  This document demonstrates using [DefaultAzureCredential][default_azure_credential] to authenticate via Azure Active Directory. However, any of the credentials offered by the [azure-identity package][azure_identity_pip] will be accepted.  See the [azure-identity][azure_identity_credentials] documentation for more information about other credentials.

  Once you have chosen and configured your credential, you can create instances of the `PurviewSharingClient`.

  ```python
  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  credential = DefaultAzureCredential()
  client = PurviewSharingClient(endpoint="https://<my-account-name>.purview.azure.com", credential=credential)
  ```



  **Data Provider:** A data provider is the individual who creates a share by selecting a data source, choosing which files and folders to share, and who to share them with. Microsoft Purview then sends an invitation to each data consumer.

  **Data Consumer:** A data consumer is the individual who accepts the invitation by specifying a target storage account in their own Azure subscription that they'll use to access the shared data.



  Table of Contents:
  - [Data Provider](#data-provider-examples)
  - [Data Consumer](#data-consumer-examples)
  - [Share Resource](#share-resource-examples)



  The following code examples demonstrate how data providers can use the Microsoft Azure Python SDK for Purview Sharing to manage their sharing activity.



  ```python Snippet:create_a_sent_share_client
  import os, uuid, json

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint, credential=credential)
  ```



  To begin sharing data, the data provider must first create a sent share that identifies the data they would like to share.

  ```python Snippet:create_a_sent_share
  import os, uuid, json

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint, credential=credential)

  sent_share_id = uuid.uuid4()

  artifact = {
      "properties": {
          "paths": [
              {
                  "containerName": "container-name",
                  "receiverPath": "shared-file-name.txt",
                  "senderPath": "original/file-name.txt"
              }
          ]
      },
      "storeKind": "AdlsGen2Account",
      "storeReference": {
          "referenceName": "/subscriptions/{subscription-id}/resourceGroups/provider-storage-rg/providers/Microsoft.Storage/storageAccounts/providerstorage",
          "type": "ArmResourceReference"
      }
  }

  sent_share = {
      "properties": {
          "artifact": artifact,
          "displayName": "sampleShare",
          "description": "A sample share"
      },
      "shareKind": "InPlace"
  }

  request = client.sent_shares.begin_create_or_replace(
      str(sent_share_id),
      sent_share=sent_share)

  response = request.result()
  print(response)
  ```



  After creating a sent share, the data provider can extend invitations to consumers who may then view the shared data. In this example, an invitation is extended to an individual by specifying their email address.

  ```python Snippet:send_a_user_invitation
  import os, uuid

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential
  from datetime import date

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint, credential=credential)

  sent_share_id = uuid.uuid4()
  sent_share_invitation_id = uuid.uuid4()

  consumerEmail = "consumer@contoso.com"
  today = date.today()
  invitation = {
      "invitationKind": "User",
      "properties": {
          "targetEmail": consumerEmail,
          "notify": "true",
          "expirationDate": date(today.year+1,today.month,today.day).strftime("%Y-%m-%d") + " 00:00:00"
      }
  }

  invitation_request = client.sent_shares.create_invitation(
      sent_share_id=str(sent_share_id),
      sent_share_invitation_id=str(sent_share_invitation_id),
      sent_share_invitation=invitation)

  invitation_response = invitation_request.result()
  created_invitation = json.loads(invitation_response)
  print(created_invitation)
  ```


  Data providers can also extend invitations to services or applications by specifying the tenant id and object id of the service. _The object id used for sending an invitation to a service must be the object id associated with the Enterprise Application (not the application registration)._

  ```python Snippet:send_a_service_invitation
  import os, uuid

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint, credential=credential)

  targetActiveDirectoryId = uuid.uuid4()
  targetObjectId = uuid.uuid4()

  sent_share_invitation = {
      "invitationKind": "Service",
      "properties": {
          "targetActiveDirectoryId": str(targetActiveDirectoryId),
          "targetObjectId": str(targetObjectId)
      }
  }

  invitation_response = client.sent_shares.create_invitation(
      sent_share_id=str(sent_share_id),
      sent_share_invitation_id=str(sent_share_invitation_id),
      sent_share_invitation=sent_share_invitation)

  print(invitation_response)
  ```



  After creating a sent share, data providers can retrieve it.

  ```python Snippet:get_a_sent_share
  import os, uuid

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()
  sent_share_id = uuid.uuid4()

  client = PurviewSharingClient(endpoint=endpoint, credential=credential)

  retrieved_sent_share = client.sent_shares.get(sent_share_id=str(sent_share_id))
  print(retrieved_sent_share)
  ```



  Data providers can also retrieve a list of the sent shares they have created.

  ```python Snippet:get_all_sent_shares
  import os

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint, credential=credential)

  provider_storage_account_resource_id = "/subscriptions/{subscription-id}/resourceGroups/provider-storage-rg/providers/Microsoft.Storage/storageAccounts/providerstorage"

  list_request = client.sent_shares.list(
      reference_name=provider_storage_account_resource_id,
      orderby="properties/createdAt desc")

  for list_response in list_request:
      print(list_response)
  ```



  A sent share can be deleted by the data provider to stop sharing their data with all data consumers.

  ```python Snippet:delete_a_sent_share
  import os

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint,credential=credential)

  sent_share_id = uuid.uuid4()

  delete_request = client.sent_shares.begin_delete(sent_share_id=str(sent_share_id))
  delete_response = delete_request.result()
  print(delete_response)
  ```



  After creating a sent share invitation, data providers can retrieve it.

  ```python Snippet:get_a_sent_share_invitation
  import os, uuid, json

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint,credential=credential)

  sent_share_id = uuid.uuid4()
  sent_share_invitation_id = uuid.uuid4()

  get_invitation_response = client.sent_shares.get_invitation(
      sent_share_id=str(sent_share_id),
      sent_share_invitation_id=str(sent_share_invitation_id))

  retrieved_share_invitation = json.loads(get_invitation_response)
  print(retrieved_share_invitation)
  ```



  Data providers can also retrieve a list of the sent share invitations they have created.

  ```python Snippet:view_sent_invitations
  import os, uuid, json

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint, credential=credential)

  sent_share_id = uuid.uuid4()

  list_request = client.sent_shares.list_invitations(sent_share_id=str(sent_share_id))

  for list_response in list_request:
      print(list_response)
  ```



  An individual sent share invitation can be deleted by the data provider to stop sharing their data with the specific data consumer to whom the invitation was addressed.

  ```python Snippet:delete_a_sent_share_invitation
  import os, uuid, json

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint,credential=credential)

  sent_share_id = uuid.uuid4()
  sent_share_invitation_id = uuid.uuid4()

  delete_invitation_request = client.sent_shares.begin_delete_invitation(
      sent_share_id=str(sent_share_id),
      sent_share_invitation_id=str(sent_share_invitation_id))
  delete_invitation_response = delete_invitation_request.result()
  print(delete_invitation_response)
  ```



  The following code examples demonstrate how data consumers can use the Microsoft Azure Python SDK for Purview Sharing to manage their sharing activity.



  ```python Snippet:create_received_share_client
  import os

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint,credential=credential)
  ```



  To begin viewing data shared with them, a data consumer must first retrieve a list of detached received shares. Within this list, they can identify a detached received share to attach. A "detached" received share refers to a received share that has never been attached or has been detached.

  ```python Snippet:get_all_detached_received_shares
  import os

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint,credential=credential)

  list_detached_response = client.received_shares.list_detached(orderby="properties/createdAt desc")
  print(list_detached_response)
  ```



  Once the data consumer has identified a received share, they can attach the received share to a location where they can access the shared data. If the received share is already attached, the shared data will be made accessible at the new location specified.

  ```python Snippet:attach_a_received_share
  import os, json

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint,credential=credential)

  consumer_storage_account_resource_id = "/subscriptions/{subscription-id}/resourceGroups/consumer-storage-rg/providers/Microsoft.Storage/storageAccounts/consumerstorage"

  list_detached_response = client.received_shares.list_detached(orderby="properties/createdAt desc")
  received_share = next(x for x in list_detached_response)

  store_reference = {
      "referenceName": consumer_storage_account_resource_id,
      "type": "ArmResourceReference"
  }

  sink = {
      "properties": {
          "containerName": "container-test",
          "folder": "folder-test",
          "mountPath": "mountPath-test",
      },
      "storeKind": "AdlsGen2Account",
      "storeReference": store_reference
  }

  received_share['properties']['sink'] = sink

  update_request = client.received_shares.begin_create_or_replace(
      received_share['id'],
      content_type="application/json",
      content=json.dumps(received_share))

  update_response = update_request.result()
  print(update_response)
  ```



  A data consumer can retrieve an individual received share.

  ```python Snippet:get_a_received_share
  import os

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint,credential=credential)

  list_detached_response = client.received_shares.list_detached(orderby="properties/createdAt desc")
  list_detached = json.loads(list_detached_response)
  received_share = list_detached[0]

  get_share_response = client.received_shares.get(received_share_id=received_share['id'])
  retrieved_share = json.loads(get_share_response)
  print(retrieved_share)
  ```



  Data consumers can also retrieve a list of their attached received shares.

  ```python Snippet:list_attached_received_shares
  import os

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint,credential=credential)

  consumer_storage_account_resource_id = "/subscriptions/{subscription-id}/resourceGroups/consumer-storage-rg/providers/Microsoft.Storage/storageAccounts/consumerstorage"

  list_attached_response = client.received_shares.list_attached(
      reference_name=consumer_storage_account_resource_id,
      orderby="properties/createdAt desc")
  print(list_attached_response)
  ```



  A received share can be deleted by the data consumer to terminate their access to shared data.

  ```python Snippet:delete_a_received_share
  import os

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint,credential=credential)

  delete_received_share_request = client.received_shares.begin_delete(received_share_id=received_share['id'])
  delete_received_share_response = delete_received_share_request.result()
  print(delete_received_share_response)
  ```



  The following code examples demonstrate how to use the Microsoft Azure Python SDK for Purview Sharing to view share resources. A share resource is the underlying resource from which a provider shares data or the destination where a consumer attaches data shared with them.



  A list of share resources can be retrieved to view all resources within an account where sharing activities have taken place.

  ```python Snippet:list_share_resources
  import os

  from azure.purview.sharing import PurviewSharingClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["ENDPOINT"]
  credential = DefaultAzureCredential()

  client = PurviewSharingClient(endpoint=endpoint,credential=credential)

  list_request = client.share_resources.list(
      filter="properties/storeKind eq 'AdlsGen2Account'",
      orderby="properties/createdAt desc")

  for list_response in list_request:
      print(list_response)
  ```





  The Purview Catalog client will raise exceptions defined in [Azure Core][azure_core] if you call `.raise_for_status()` on your responses.



  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` keyword argument:

  ```python
  import sys
  import logging
  from azure.identity import DefaultAzureCredential
  from azure.purview.sharing import PurviewSharingClient


  logger = logging.getLogger('azure')
  logger.setLevel(logging.DEBUG)


  handler = logging.StreamHandler(stream=sys.stdout)
  logger.addHandler(handler)

  endpoint = "https://<my-account-name>.share.purview.azure.com"
  credential = DefaultAzureCredential()


  client = PurviewSharingClient(endpoint=endpoint, credential=credential, logging_enable=True)
  ```

  Similarly, `logging_enable` can enable detailed logging for a single `send_request` call,
  even when it isn't enabled for the client:

  ```python
  result = client.types.get_all_type_definitions(logging_enable=True)
  ```



  For more generic samples, see our [samples][samples].



  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->

  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/purview/azure-purview-sharing/azure/purview/sharing
  [client_pypi_package]: https://aka.ms/azsdk/python/purviewsharing/pypi
  [sharing_ref_docs]: https://aka.ms/azsdk/python/purviewcatalog/ref-docs
  [sharing_product_documentation]: https://azure.microsoft.com/services/purview/
  [azure_subscription]: https://azure.microsoft.com/free/
  [purview_resource]: https://docs.microsoft.com/azure/purview
  [pip]: https://pypi.org/project/pip/
  [authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
  [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
  [azure_identity_pip]: https://pypi.org/project/azure-identity/
  [default_azure_credential]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-identity/latest/azure.identity.html#azure.identity.DefaultAzureCredential
  [request_builders_and_client]: https://aka.ms/azsdk/python/protocol/quickstart
  [enable_aad]: https://docs.microsoft.com/azure/purview/
  [azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [python_logging]: https://docs.python.org/3.5/library/logging.html
  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com
  [samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/purview/azure-purview-sharing/samples


pkgId: 924f25d1eb7feb61e283fc295a5a049035d759bd22a1a0b0a3ae06b3d6a4e95a
name: python-azure-pylint-guidelines-checker
arch: src
version: 0.0.8
epoch: 0
release: 1
summary: A pylint plugin which enforces azure sdk guidelines.
url: http://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-pylint-guidelines-checker-0.0.8-1.src.rpm
checksum_type: sha256
description:
  The code presented in this repository is a lift-and-shift of code [originally written by @kristapratico](https://github.com/Azure/azure-sdk-for-python/blob/ae2948416956938c908dcfb570a7456b23482149/scripts/pylint_custom_plugin/)



  In order to lint for the guidelines, you must make sure you are enabling the `pylint-guidelines-checker` in your pylint invocation. Using the rcfile at the [root of the repo](https://github.com/Azure/azure-sdk-for-python/blob/main/pylintrc) will ensure that the plugin is properly activated

  It is recommended you run pylint at the library package level to be consistent with how the CI runs pylint.

  Check that you are running pylint version >=2.14.5 and astroid version >=2.12.0.


  0. Install the pylint checker from the azure-sdk development feed.
      ```bash
      pip install --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" pylint-guidelines-checker
      ```

  1. Run pylint at the root of the repo and it will automatically find the pylintrc:
      ```bash
      C:\azure-sdk-for-python>pylint sdk/storage/azure-storage-blob/azure
      ```
  2. Add the --rcfile command line argument with a relative path to the pylintrc from your current directory:
      ```bash
      C:\azure-sdk-for-python\sdk\storage>pylint --rcfile="../../pylintrc" azure-storage-blob
      ```
  3. Set the environment variable PYLINTRC to the absolute path of the pylintrc file:
      ```bash
      set PYLINTRC=C:\azure-sdk-for-python\pylintrc
      ```
      Run pylint:
      ```bash
      C:\azure-sdk-for-python\sdk\storage>pylint azure-storage-blob
      ```
  4. Run pylint at the package level using tox and it will find the pylintrc file:
      ```bash
      pip install tox tox-monorepo
      C:\azure-sdk-for-python\sdk\storage\azure-storage-blob>tox -e lint -c ../../../eng/tox/tox.ini
      ```
  5. If you use the pylint extension for VS code or Pycharm it *should* find the pylintrc automatically.



  ```bash

  ```

  The pylint custom checkers for SDK guidelines fall into messages range C4717 - C4738.
  You will know you came across a custom checker if it contains a link to the guidelines.

  In the case of a false positive, use the disable command to remove the pylint error.



  | Pylint checker name                                | How to fix this                                                                                                                                                      | How to disable this rule                                                                 | Link to python guideline                                                                      |
  |----------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
  | client-method-should-not-use-static-method         | Use module level functions instead.                                                                                                                                  | # pylint:disable=client-method-should-not-use-static-method                       | [link](https://azure.github.io/azure-sdk/python_implementation.html#method-signatures) |
  | missing-client-constructor-parameter-credential    | Add a credential parameter to the client constructor. Do not use plural form "credentials".                                                                          | # pylint:disable=missing-client-constructor-parameter-credential                         | [link](https://azure.github.io/azure-sdk/python_design.html#client-configuration) |
  | missing-client-constructor-parameter-kwargs        | Add a **kwargs parameter to the client constructor.                                                                                                                  | # pylint:disable=missing-client-constructor-parameter-kwargs                             | [link](https://azure.github.io/azure-sdk/python_design.html#client-configuration) |
  | client-method-has-more-than-5-positional-arguments | Use keyword arguments to reduce number of positional arguments.                                                                                                      | # pylint:disable=client-method-has-more-than-5-positional-arguments                      | [link](https://azure.github.io/azure-sdk/python_implementation.html#method-signatures)          |
  | client-method-missing-type-annotations             | Check that param/return type comments are present or that param/return type annotations are present. Check that you did not mix type comments with type annotations. | # pylint:disable=client-method-missing-type-annotations                                  | [link](https://azure.github.io/azure-sdk/python_implementation.html#types-or-not)               |
  | client-incorrect-naming-convention                 | Check that you use... snake_case for variable, function, and method names. Pascal case for types. ALL CAPS for constants.                                            | # pylint:disable=client-incorrect-naming-convention                                      | [link](https://azure.github.io/azure-sdk/python_implementation.html#naming-conventions)         |
  | client-method-missing-kwargs                       | Check that any methods that make network calls have a **kwargs parameter.                                                                                            | # pylint:disable=client-method-missing-kwargs                                            | [link](https://azure.github.io/azure-sdk/python_design.html#constructors-and-factory-methods) |
  | config-missing-kwargs-in-policy                    | Check that the policies in your configuration function contain a **kwargs parameter.                                                                                 | # pylint:disable=config-missing-kwargs-in-policy                                         | [link](https://azure.github.io/azure-sdk/python_design.html#client-configuration) |
  | async-client-bad-name                              | Remove "Async" from your service client's name.                                                                                                                      | # pylint:disable=async-client-bad-name                                                   | [link](https://azure.github.io/azure-sdk/python_design.html#async-support)                    |
  | file-needs-copyright-header                        | Add a copyright header to the top of your file.                                                                                                                      | # pylint:disable=file-needs-copyright-header                                             | [link](https://azure.github.io/azure-sdk/policies_opensource.html#)                            |
  | client-method-name-no-double-underscore            | Don't use method names prefixed with "__".                                                                                                                           | # pylint:disable=client-method-name-no-double-underscore                                 | [link](https://azure.github.io/azure-sdk/python_implementation.html#public-vs-private)          |
  | specify-parameter-names-in-call                    | Specify the parameter names when calling methods with more than 2 required positional parameters. e.g. self.get_foo(one, two, three=three, four=four, five=five)     | # pylint:disable=specify-parameter-names-in-call                                         | [link](https://azure.github.io/azure-sdk/python_implementation.html#python-codestyle-positional-params)          |
  | connection-string-should-not-be-constructor-param  | Remove connection string parameter from client constructor. Create a method that creates the client using a connection string.                                       | # pylint:disable=connection-string-should-not-be-constructor-param                       | [link](https://azure.github.io/azure-sdk/python_design.html#python-client-connection-string) |
  | package-name-incorrect                             | Change your distribution package name to only include dashes, e.g. azure-storage-file-share                                                                          | # pylint:disable=package-name-incorrect                                                  | [link](https://azure.github.io/azure-sdk/python_design.html#packaging)                |
  | client-suffix-needed                               | Service client types should use a "Client" suffix, e.g. BlobClient.                                                                                                  | # pylint:disable=client-suffix-needed                                                    | [link](https://azure.github.io/azure-sdk/python_design.html#service-client)                          |
  | docstring-admonition-needs-newline                 | Add a blank newline above the .. literalinclude statement.                                                                                                           | # pylint:disable=docstring-admonition-needs-newline                                      | No guideline, just helps our docs get built correctly for microsoft docs.                     |
  | naming-mismatch                 | Do not alias models imported from the generated code.                                                                       | # pylint:disable=naming-mismatch                                      | [link](https://github.com/Azure/autorest/blob/main/docs/generate/built-in-directives.md)                     |
  | client-accepts-api-version-keyword                | Ensure that the client constructor accepts a keyword-only api_version argument.                                                                       | # pylint:disable=client-accepts-api-version-keyword                                  | [link](https://azure.github.io/azure-sdk/python_design.html#specifying-the-service-version)                     |
  | enum-must-be-uppercase                 |  The enum name must be all uppercase.                                                                                                           | # pylint:disable=enum-must-be-uppercase                                      | [link](https://azure.github.io/azure-sdk/python_design.html#enumerations)                     |
  | enum-must-inherit-case-insensitive-enum-meta                 |  The enum should inherit from CaseInsensitiveEnumMeta.                                                                                                           | # pylint:disable=enum-must-inherit-case-insensitive-enum-meta                                      | [link](https://azure.github.io/azure-sdk/python_implementation.html#extensible-enumerations)                     |
  | networking-import-outside-azure-core-transport                 | This import is only allowed in azure.core.pipeline.transport.                                                                                                          | # pylint:disable=networking-import-outside-azure-core-transport                                     | [link](https://github.com/Azure/azure-sdk-for-python/issues/24989)                     |
  | non-abstract-transport-import                      | Only import abstract transports. Let core or end-user decide which transport to use.                                                                                                            | # pylint:disable=non-abstract-transport-import                                     | [link](https://github.com/Azure/azure-sdk-for-python/issues/25533)                     |
  | no-raise-with-traceback               | Check that raise_with_traceback from azure-core is replaced with python 3 'raise from' syntax.                                                                                                         | # pylint:disable=no-raise-with-traceback                                     | [link](https://github.com/Azure/azure-sdk-for-python/issues/26759)
  | name-too-long                 | Check that the length of class names, function names, and variable names are under 40 characters.                                                                                                            | # pylint:disable=name-too-long                                      |[link](https://github.com/Azure/azure-sdk-for-python/issues/26640)
  | delete-operation-wrong-return-type                | Check that delete* or begin_delete* methods return None or LROPoller[None].                                                                                                        | # pylint:disable=delete-operation-wrong-return-type                                      | [link](https://github.com/Azure/azure-sdk-for-python/issues/26662)
  client-method-missing-tracing-decorator |pylint:disable=client-method-missing-tracing-decorator       |   Check that sync client methods that make network calls have the sync distributed tracing decorator.                         | [link](https://guidelinescollab.github.io/azure-sdk/python_implementation.html#distributed-tracing)                     |
  client-method-missing-tracing-decorator-async | pylint:disable=client-method-missing-tracing-decorator-async    |       Check that async client methods that make network calls have the async distributed tracing decorator.                        | [link](https://guidelinescollab.github.io/azure-sdk/python_implementation.html#distributed-tracing)                     |


pkgId: a41058e666901f37662fb313d9c1ee845800e52ba3f8a642404635c37698bbe8
name: python-azure-quantum
arch: src
version: 2.1.2
epoch: 0
release: 1
summary: Python client for Azure Quantum
url: https://github.com/microsoft/azure-quantum-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-quantum-2.1.2-1.src.rpm
checksum_type: sha256
description:
  ![Azure Quantum logo](https://raw.githubusercontent.com/microsoft/qdk-python/main/azure-quantum/Azure-Quantum-logo.png)



  [![Build Status](https://dev.azure.com/ms-quantum-public/Microsoft%20Quantum%20(public)/_apis/build/status/microsoft.qdk-python?branchName=main)](https://dev.azure.com/ms-quantum-public/Microsoft%20Quantum%20(public)/_build/latest?definitionId=32&branchName=main) [![PyPI version](https://badge.fury.io/py/azure-quantum.svg)](https://badge.fury.io/py/azure-quantum)

  Azure Quantum is Microsoft's cloud service for running Quantum Computing programs and circuits with our quantum partners and technologies. The `azure-quantum` package for Python provides functionality for interacting with Azure Quantum workspaces, including creating jobs, listing jobs, and retrieving job results. For more information, view the [Azure Quantum Documentation](https://learn.microsoft.com/en-us/azure/quantum/).

  This package supports submitting quantum programs or circuits written with Python. To submit quantum programs written with Q#, Microsoft's Domain-specific language for Quantum Programming, view [Submit Q# Jobs to Azure Quantum](https://learn.microsoft.com/azure/quantum/how-to-submit-jobs).



  The package is released on PyPI and can be installed via `pip`:

  ```bash
  pip install azure-quantum
  ```

  To use `azure-quantum` for submitting quantum circuits expressed with [Qiskit](https://pypi.org/project/qiskit), install with optional dependencies:

  ```bash
  pip install azure-quantum[qiskit]
  ```

  To use `azure-quantum` for submitting quantum circuits expressed with [Cirq](https://pypi.org/project/cirq), install with optional dependencies:

  ```bash
  pip install azure-quantum[cirq]
  ```



  To work in Azure Quantum, you need an Azure subscription. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/). Follow the [Create an Azure Quantum workspace](https://learn.microsoft.com/azure/quantum/how-to-create-workspace) how-to guide to set up your Workspace and enable your preferred providers.

  To get started, visit the following Quickstart guides:

  - [Quickstart: Submit a circuit with Qiskit](https://learn.microsoft.com/azure/quantum/quickstart-microsoft-qiskit)
  - [Quickstart: Submit a circuit with Cirq](https://learn.microsoft.com/azure/quantum/quickstart-microsoft-qiskit)
  - [Quickstart: Submit a circuit with a provider-specific format](https://learn.microsoft.com/azure/quantum/quickstart-microsoft-provider-format).



  To connect to your Azure Quantum Workspace, go to the [Azure Portal](https://portal.azure.com), navigate to your Workspace and copy-paste the resource ID and location into the code snippet below.

  ```python
  from azure.quantum import Workspace


  workspace = Workspace(
      resource_id="",
      location=""
  )
  ```



  To list all targets that are available to your workspace, run

  ```python
  workspace.get_targets()
  ```



  First, define a quantum program or circuit, and create a job by submitting it to one of the available targets:

  ```python

  target = workspace.get_targets("mytarget")


  job = target.submit(my_quantum_program)


  result = job.get_results()
  ```



  You can find example Python scripts that use the Azure Quantum Python API in the [examples](https://github.com/microsoft/qdk-python/tree/main/azure-quantum/examples) directory.



  For details on contributing to this package, see the [contributing guide](https://github.com/microsoft/qdk-python/blob/main/CONTRIBUTING.md).

  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit
  https://cla.microsoft.com.

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
  For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
  or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.



  If you run into any problems or bugs using this package, please head over to the [issues](https://github.com/microsoft/qdk-python/issues) page and open a new issue, if it does not already exist.


pkgId: 9a4a701753ac6106f2beb2a3396b84c8a9e5c9f4dc1225911fbffa80c22bf8ff
name: python-azure-requests
arch: src
version: 24.4
epoch: 0
release: 1
summary: Requests wrapper for Azure DevOps
url: https://github.com/presidento/azure-requests
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-requests-24.4-1.src.rpm
checksum_type: sha256
description:
  Just a wrapper around Python requests module for communicating with Azure DevOps.



  - Authentication
  - Replace organization, project, and team in URL, so URLs can be copy-pasted from the documentation
  - Handle rate limit
  - Handle ADO temporary server errors
  - Set appropriate Content-Type headers
  - Parse JSON automatically
  - Raise exception for wrong HTTPS statuses



  Azure DevOps has an excellent HTTPS API with an excellent documentation. It is easy to understand and easy to use. For smaller scripts and projects it is easier to use them as is. Every existing API implementations have many documentation issues.



  ```python
  from azure_requests import AzureRequests

  azure_requests = AzureRequests(
      pat="<YOUR PAT>",
      organization="<YOUR ORGANIZATION>",
  )

  WORK_ITEM_ID = 12345

  work_item_fields = azure_requests.call(
      
      "PATCH https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?api-version=7.0",
      
      params={
          "id": WORK_ITEM_ID,
      },
      
      data=[
          {
              "op": "test",
              "path": "/id",
              "value": WORK_ITEM_ID,
          }
      ],
      
      result_key="fields"
  )

  print(work_item_fields)
  ```

  For a more detailed example see `example.py`.


pkgId: 3f2e12f95e6fafd49f001fd071cd77711273e571c6ef7a4312cc201ae29332a2
name: python-azure-schemaregistry
arch: src
version: 1.3.0
epoch: 0
release: 1
summary: Microsoft Azure Azure Schema Registry Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-schemaregistry-1.3.0-1.src.rpm
checksum_type: sha256
description:
  Azure Schema Registry is a schema repository service hosted by Azure Event Hubs, providing schema storage, versioning,
  and management. The registry is leveraged by encoders to reduce payload size while describing payload structure with
  schema identifiers rather than full schemas. This package provides:

  1. A client library to register and retrieve schemas and their respective properties.

  2. An JSON schema-based encoder capable of encoding and decoding payloads containing
  Schema Registry schema identifiers, corresponding to JSON schemas used for validation, and encoded content.

  [Source code][source_code]
  | [Package (PyPi)][pypi]
  | [Package (Conda)](https://anaconda.org/microsoft/azure-schemaregistry/)
  | [API reference documentation][api_reference]
  | [Samples][sr_samples]
  | [Changelog][change_log]



  _Azure SDK Python packages support for Python 2.7 has ended on 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_





  Install the Azure Schema Registry client library for Python with [pip][pip]:

  ```Bash
  pip install azure-schemaregistry
  ```

  To use the built-in `jsonschema` validators with the JSON Schema Encoder, install `jsonencoder` extras:

  ```Bash
  pip install azure-schemaregistry[jsonencoder]
  ```


  To use this package, you must have:
  * Azure subscription - [Create a free account][azure_sub]
  * [Azure Schema Registry][schemaregistry_service] - [Here is the quickstart guide][quickstart_guide] to create a Schema Registry group using the Azure portal.
  * Python 3.8 or later - [Install Python][python]



  Interaction with Schema Registry starts with an instance of SchemaRegistryClient class. The client constructor takes an Azure Event Hubs fully qualified namespace and an Azure Active Directory credential:

  * The fully qualified namespace of the Schema Registry instance should follow the format: `<yournamespace>.servicebus.windows.net`.

  * An AAD credential that implements the [TokenCredential][token_credential_interface] protocol should be passed to the constructor. There are implementations of the `TokenCredential` protocol available in the
  [azure-identity package][pypi_azure_identity]. To use the credential types provided by `azure-identity`, please install the Azure Identity client library for Python with [pip][pip]:

  ```Bash
  pip install azure-identity
  ```

  * Additionally, to use the async API,  you must first install an async transport, such as [aiohttp](https://pypi.org/project/aiohttp/):

  ```Bash
  pip install aiohttp
  ```

  **Create client using the azure-identity library:**

  ```python
  from azure.schemaregistry import SchemaRegistryClient
  from azure.identity import DefaultAzureCredential

  credential = DefaultAzureCredential()

  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_FULLY_QUALIFIED_NAMESPACE']
  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace, credential)
  ```

  **Create JsonSchemaEncoder using the azure-schemaregistry library:**

  ```python
  import os
  from azure.schemaregistry import SchemaRegistryClient
  from azure.schemaregistry.encoder.jsonencoder import JsonSchemaEncoder
  from azure.identity import DefaultAzureCredential

  credential = DefaultAzureCredential()

  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_FULLY_QUALIFIED_NAMESPACE']
  group_name = os.environ['SCHEMAREGISTRY_GROUP']
  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace, credential)
  encoder = JsonSchemaEncoder(client=schema_registry_client, group_name=group_name)
  ```





  * Schema: Schema is the organization or structure for data. More detailed information can be found [here][schemas].

  * Schema Group: A logical group of similar schemas based on business criteria, which can hold multiple versions of a schema. More detailed information can be found [here][schema_groups].

  * SchemaRegistryClient: `SchemaRegistryClient` provides the API for storing and retrieving schemas in schema registry.



  * JsonSchemaEncoder: Provides API to encode content to and decode content from Binary Encoding, validate content against a JSON Schema, and cache schemas/schema IDs retrived from the registry using the `SchemaRegistryClient` locally.

  * OutboundMessageContent: Protocol defined under `azure.schemaregistry` that allows for `JsonSchemaEncoder.encode` interoperability with certain Azure Messaging SDK message types. Support has been added to:
    * `azure.eventhub.EventData` for `azure-eventhub>=5.9.0`

  * InboundMessageContent: Protocol defined under `azure.schemaregistry` that allows for `JsonSchemaEncoder.decode` interoperability with certain Azure Messaging SDK message types. Support has been added to:
    * `azure.eventhub.EventData` for `azure-eventhub>=5.9.0`



  If a message type that follows the OutboundMessageContent protocol is provided to the `JsonSchemaEncoder`, it will set the corresponding content and content type properties. If a message type object that follows the InboundMessageContent protocol is provided to the encoder, it will get the corresponding content and content type properties. These are defined as:

  * `content`: Binary-encoded, JSON schema-validated payload (in general, format-specific payload)

  * `content type`: a string of the format `application/json;serialization=Json+<schema ID>`, where:
    * `application/json;serialization=Json` is the format indicator
    * `<schema ID>` is the hexadecimal representation of GUID, same format and byte order as the string from the Schema Registry service.

  If `EventData` is passed in as the message type, the following properties will be set on the `EventData` object:

  * The `body` property will be set to the encoded content value.

  * The `content_type` property will be set to the content type value.

  If message type is not provided, and by default, the encoder will create the following dict:
  `{"content": <encoded payload>, "content_type": 'application/json;serialization=Json+<schema ID>'}`



  The following sections provide several code snippets covering some of the most common Schema Registry and Json Schema Encoder tasks, including:

  * [Register a schema](#register-a-schema)
  * [Get the schema by id](#get-the-schema-by-id)
  * [Get the schema by version](#get-the-schema-by-version)
  * [Get the id of a schema](#get-the-id-of-a-schema)

  * [Encode](#encode)
  * [Decode](#decode)
  * [Event Hubs Send Integration](#event-hubs-send-integration)
  * [Event Hubs Receive Integration](#event-hubs-receive-integration)



  Use `SchemaRegistryClient.register_schema` method to register a schema.

  ```python
  import os

  from azure.identity import DefaultAzureCredential
  from azure.schemaregistry import SchemaRegistryClient

  token_credential = DefaultAzureCredential()
  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_AVRO_FULLY_QUALIFIED_NAMESPACE']
  group_name = os.environ['SCHEMA_REGISTRY_GROUP']
  name = "your-schema-name"
  format = "Avro"
  definition = """
  {"namespace": "example.avro",
   "type": "record",
   "name": "User",
   "fields": [
       {"name": "name", "type": "string"},
       {"name": "favorite_number",  "type": ["int", "null"]},
       {"name": "favorite_color", "type": ["string", "null"]}
   ]
  }
  """

  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace=fully_qualified_namespace, credential=token_credential)
  with schema_registry_client:
      schema_properties = schema_registry_client.register_schema(group_name, name, definition, format)
      id = schema_properties.id
  ```



  Get the schema definition and its properties by schema id.

  ```python
  import os

  from azure.identity import DefaultAzureCredential
  from azure.schemaregistry import SchemaRegistryClient

  token_credential = DefaultAzureCredential()
  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_AVRO_FULLY_QUALIFIED_NAMESPACE']
  schema_id = 'your-schema-id'

  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace=fully_qualified_namespace, credential=token_credential)
  with schema_registry_client:
      schema = schema_registry_client.get_schema(schema_id)
      definition = schema.definition
      properties = schema.properties
  ```



  Get the schema definition and its properties by schema version.

  ```python
  import os

  from azure.identity import DefaultAzureCredential
  from azure.schemaregistry import SchemaRegistryClient

  token_credential = DefaultAzureCredential()
  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_AVRO_FULLY_QUALIFIED_NAMESPACE']
  group_name = os.environ["SCHEMAREGISTRY_GROUP"]
  name = "your-schema-name"
  version = int("<your schema version>")

  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace=fully_qualified_namespace, credential=token_credential)
  with schema_registry_client:
      schema = schema_registry_client.get_schema(group_name=group_name, name=name, version=version)
      definition = schema.definition
      properties = schema.properties
  ```



  Get the schema id of a schema by schema definition and its properties.

  ```python
  import os

  from azure.identity import DefaultAzureCredential
  from azure.schemaregistry import SchemaRegistryClient

  token_credential = DefaultAzureCredential()
  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_AVRO_FULLY_QUALIFIED_NAMESPACE']
  group_name = os.environ['SCHEMA_REGISTRY_GROUP']
  name = "your-schema-name"
  format = "Avro"
  definition = """
  {"namespace": "example.avro",
   "type": "record",
   "name": "User",
   "fields": [
       {"name": "name", "type": "string"},
       {"name": "favorite_number",  "type": ["int", "null"]},
       {"name": "favorite_color", "type": ["string", "null"]}
   ]
  }
  """

  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace=fully_qualified_namespace, credential=token_credential)
  with schema_registry_client:
      schema_properties = schema_registry_client.register_schema(group_name, name, definition, format)
      id = schema_properties.id
  ```



  Use the `SchemaRegistryClient` to pre-register the schema. Encode and validate the content with the `JsonSchemaEncoder`.

  The `encode` method automatically retrieves the schema from the Schema Registry Service, validates against the content, and caches the schema locally.

  ```python
  import os
  import json
  from azure.schemaregistry import SchemaRegistryClient, SchemaFormat
  from azure.schemaregistry.encoder.jsonencoder import JsonSchemaEncoder
  from azure.identity import DefaultAzureCredential
  from azure.eventhub import EventData

  token_credential = DefaultAzureCredential()
  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_JSON_FULLY_QUALIFIED_NAMESPACE']
  group_name = os.environ['SCHEMAREGISTRY_GROUP']
  format = SchemaFormat.JSON
  DRAFT2020_12_SCHEMA_IDENTIFIER = "https://json-schema.org/draft/2020-12/schema"

  schema = {
      "$id": "https://example.com/person.schema.json",
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "title": "Person",
      "type": "object",
      "properties": {
          "name": {
              "type": "string",
              "description": "Person's name."
          },
          "favorite_color": {
              "type": "string",
              "description": "Favorite color."
          },
          "favorite_number": {
              "description": "Favorite number.",
              "type": "integer",
          }
      }
  }
  name = schema["title"]
  definition = json.dumps(schema)

  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace, token_credential)
  schema_properties = schema_registry_client.register_schema(group_name, name, definition, format)
  schema_id = schema_properties.id


  encoder = JsonSchemaEncoder(client=schema_registry_client, validate=DRAFT2020_12_SCHEMA_IDENTIFIER, group_name=group_name)

  with encoder:
      dict_content = {"name": "Ben", "favorite_number": 7, "favorite_color": "red"}
      event_data = encoder.encode(dict_content, schema_id=schema_id, message_type=EventData)

      

      message_content_dict = encoder.encode(dict_content, schema_id=schema_id)
      event_data = EventData.from_message_content(message_content_dict["content"], message_content_dict["content_type"])

      

      dict_content = {"name": "Ben", "favorite_number": 7, "favorite_color": "red"}
      message_content = encoder.encode(dict_content, schema=definition)  # group_name required in constructor when `schema` is passed
  ```



  Decode the content with the `JsonSchemaEncoder`.

  The `decode` method automatically retrieves the schema from the Schema Registry Service, validates against the content, and caches the schema locally.

  ```python
  import os
  from azure.schemaregistry import SchemaRegistryClient
  from azure.schemaregistry.encoder.jsonencoder import JsonSchemaEncoder
  from azure.identity import DefaultAzureCredential

  token_credential = DefaultAzureCredential()
  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_FULLY_QUALIFIED_NAMESPACE']
  group_name = os.environ["SCHEMAREGISTRY_GROUP"]
  DRAFT2020_12_SCHEMA_IDENTIFIER = "https://json-schema.org/draft/2020-12/schema"

  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace, token_credential)
  encoder = JsonSchemaEncoder(client=schema_registry_client, validate=DRAFT2020_12_SCHEMA_IDENTIFIER)

  with encoder:
      
      decoded_content = encoder.decode(event_data)

      

      
      decoded_content = encoder.decode(content_dict)
  ```



  Integration with [Event Hubs][eventhubs_repo] to send an `EventData` object with `body` set to encoded content and corresponding `content_type`.

  ```python
  import os
  from azure.eventhub import EventHubProducerClient, EventData
  from azure.schemaregistry import SchemaRegistryClient
  from azure.schemaregistry.encoder.jsonencoder import JsonSchemaEncoder
  from azure.identity import DefaultAzureCredential

  token_credential = DefaultAzureCredential()
  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_JSON_FULLY_QUALIFIED_NAMESPACE']
  group_name = os.environ['SCHEMAREGISTRY_GROUP']
  eventhub_connection_str = os.environ['EVENT_HUB_CONN_STR']
  eventhub_name = os.environ['EVENT_HUB_NAME']

  schema_id = os.environ['PERSON_JSON_SCHEMA_ID']
  DRAFT2020_12_SCHEMA_IDENTIFIER = "https://json-schema.org/draft/2020-12/schema"

  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace, token_credential)
  json_schema_encoder = JsonSchemaEncoder(client=schema_registry_client, validate=DRAFT2020_12_SCHEMA_IDENTIFIER)

  eventhub_producer = EventHubProducerClient.from_connection_string(
      conn_str=eventhub_connection_str,
      eventhub_name=eventhub_name
  )

  with eventhub_producer, json_schema_encoder:
      event_data_batch = eventhub_producer.create_batch()
      dict_content = {"name": "Bob", "favorite_number": 7, "favorite_color": "red"}
      event_data = json_schema_encoder.encode(dict_content, schema_id=schema_id, message_type=EventData)
      event_data_batch.add(event_data)
      eventhub_producer.send_batch(event_data_batch)
  ```



  Integration with [Event Hubs][eventhubs_repo] to receive an `EventData` object and decode the encoded `body` value.

  ```python
  import os
  from azure.eventhub import EventHubConsumerClient
  from azure.schemaregistry import SchemaRegistryClient
  from azure.schemaregistry.encoder.jsonencoder import JsonSchemaEncoder
  from azure.identity import DefaultAzureCredential

  token_credential = DefaultAzureCredential()
  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_JSON_FULLY_QUALIFIED_NAMESPACE']
  group_name = os.environ['SCHEMAREGISTRY_GROUP']
  eventhub_connection_str = os.environ['EVENT_HUB_CONN_STR']
  eventhub_name = os.environ['EVENT_HUB_NAME']
  DRAFT2020_12_SCHEMA_IDENTIFIER = "https://json-schema.org/draft/2020-12/schema"

  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace, token_credential)
  json_schema_encoder = JsonSchemaEncoder(client=schema_registry_client, validate=DRAFT2020_12_SCHEMA_IDENTIFIER)

  eventhub_consumer = EventHubConsumerClient.from_connection_string(
      conn_str=eventhub_connection_str,
      consumer_group='$Default',
      eventhub_name=eventhub_name,
  )

  def on_event(partition_context, event):
      decoded_content = json_schema_encoder.decode(event)

  with eventhub_consumer, json_schema_encoder:
      eventhub_consumer.receive(on_event=on_event, starting_position="-1")
  ```





  Schema Registry clients raise exceptions defined in [Azure Core][azure_core] if errors are encountered when communicating with the Schema Registry service.

  Errors when encoding and decoding related to invalid content/content types will be raised as `azure.schemaregistry.encoder.jsonencoder.InvalidContentError`, where `__cause__` will possibly contain an underlying exception.


  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` argument:

  ```python
  import sys
  import os
  import logging
  from azure.schemaregistry import SchemaRegistryClient
  from azure.schemaregistry.encoder.jsonencoder import JsonSchemaEncoder
  from azure.identity import DefaultAzureCredential


  logger = logging.getLogger('azure.schemaregistry')
  logger.setLevel(logging.DEBUG)


  handler = logging.StreamHandler(stream=sys.stdout)
  logger.addHandler(handler)

  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_FULLY_QUALIFIED_NAMESPACE']
  group_name = os.environ['SCHEMAREGISTRY_GROUP']
  DRAFT2020_12_SCHEMA_IDENTIFIER = "https://json-schema.org/draft/2020-12/schema"
  credential = DefaultAzureCredential()

  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace, credential, logging_enable=True)
  encoder = JsonSchemaEncoder(client=schema_registry_client, validate=DRAFT2020_12_SCHEMA_IDENTIFIER)
  ```

  Similarly, `logging_enable` can enable detailed logging for a single operation,
  even when it isn't enabled for the client:

  ```python
  schema_registry_client.get_schema(schema_id, logging_enable=True)
  ```





  Please take a look at the [samples][sr_samples] directory for detailed examples of how to use this library to register and retrieve schema to/from Schema Registry.



  This project welcomes contributions and suggestions.  Most contributions require you to agree to a
  Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
  the rights to use your contribution. For details, visit https://cla.microsoft.com.

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
  a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
  provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
  For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
  contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

  <!-- LINKS -->
  [pip]: https://pypi.org/project/pip/
  [pypi]: https://pypi.org/project/azure-schemaregistry
  [python]: https://www.python.org/downloads/
  [azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [azure_sub]: https://azure.microsoft.com/free/
  [python_logging]: https://docs.python.org/3/library/logging.html
  [sr_samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/schemaregistry/azure-schemaregistry/samples
  [api_reference]: https://docs.microsoft.com/python/api/overview/azure/schemaregistry-readme
  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/schemaregistry/azure-schemaregistry
  [change_log]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/schemaregistry/azure-schemaregistry/CHANGELOG.md
  [schemas]: https://docs.microsoft.com/azure/event-hubs/schema-registry-overview#schemas
  [schema_groups]: https://docs.microsoft.com/azure/event-hubs/schema-registry-overview#schema-groups
  [schemaregistry_service]: https://aka.ms/schemaregistry
  [token_credential_interface]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core/azure/core/credentials.py
  [eventhubs_repo]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/eventhub/azure-eventhub
  [pypi_azure_identity]: https://pypi.org/project/azure-identity/
  [quickstart_guide]: https://docs.microsoft.com/azure/event-hubs/create-schema-registry





  This version and all future versions will require Python 3.8+. Python 3.7 is no longer supported.



  - Sync and async `JsonSchemaEncoder` have been added under `azure.schemaregistry.encoder.jsonencoder`.
  - `InvalidContentError` have been added under `azure.schemaregistry.encoder.jsonencoder` for use with the `JsonSchemaEncoder`.
  - `MessageContent`, `OutboundMessageContent`,`InboundMessageContent`, and `SchemaContentValidate` have been added under `azure.schemaregistry` as protocols for use with the `JsonSchemaEncoder` and/or future encoder implementations.
  - `Json` and `Custom` have been added to supported formats in `SchemaFormat`.
  - `V2022_10` has been added to `ApiVersion` and set as the default API version.



  - Fixed a bug in sync/async `register_schema` and `get_schema_properties` that did not accept case insensitive strings as an argument to the `format` parameter.
  - Fixed a bug where unknown content type strings from the service raised a client error, rather than being returned as a string in the SchemaProperties `format` property.



  - Updated azure-core minimum dependency to 1.28.0.
  - Added support for Python 3.11 and 3.12.
  - The following features have been temporarily pulled out and will be added back in future previews as we work towards a stable release:
    - `V2023_07_01` in `ApiVersion`.
      - `PROTOBUF` in `SchemaFormat`.





  - `V2023_07_01` has been added to `ApiVersion` and set as the default API version.
    - `Protobuf` has been added to supported formats in `SchemaFormat`.



  - Added support for Python 3.12.





  The following features are experimental and may be removed:

  - Sync and async `JsonSchemaEncoder` have been added under `azure.schemaregistry.encoder.jsonencoder`.
  - `InvalidContentError` and `JsonSchemaDraftIdentifier` have been added under `azure.schemaregistry.encoder.jsonencoder` for use with the `JsonSchemaEncoder`.
  - `MessageType`, `MessageContent`, `SchemaContentValidate`, `SchemaEncoder` have been added under `azure.schemaregistry` as protocols to define/for use with the `JsonSchemaEncoder` and future encoder implementations.





  - `V2022_10` has been added to `ApiVersion` and set as the default api version.
    - `Json` and `Custom` have been added to supported formats in `SchemaFormat`.
    - At the time of this release, only Draft 3 of JSON schemas is currently supported by the service.



  - Fixed a bug in sync/async `register_schema` and `get_schema_properties` that did not accept case insensitive strings as an argument to the `format` parameter.



  - Added support for Python 3.11.



  This version and all future versions will require Python 3.7+, Python 3.6 is no longer supported.



  - `group_name`, `name`, and `version` have been added as optional parameters to the `get_schema` method on the sync and async `SchemaRegistryClient`.
  - `version` has been added to `SchemaProperties`.



  - Updated azure-core minimum dependency to 1.24.0.
  - Added distributed tracing support for sync and async `SchemaRegistryClient`.



  This version and all future versions will require Python 3.6+. Python 2.7 is no longer supported.



  - `group_name` and `name` have been added as instance variables to `SchemaProperties`.



  - Updated azure-core minimum dependency to 1.23.0.



  **Note:** This is the first stable release of our efforts to create a user-friendly and Pythonic client library for Azure Schema Registry.



  - `SchemaRegistryClient` is the top-level client class interacting with the Azure Schema Registry Service. It provides three methods:
    - `register_schema`: Store schema in the service by providing schema group name, schema name, schema definition, and schema format.
    - `get_schema`: Get schema definition and its properties by schema id.
    - `get_schema_properties`: Get schema properties by providing schema group name, schema name, schema definition, and schema format.
  - `SchemaProperties` has the following instance variables: `id` and `format`:
    - The type of `format` has been changed from `str` to `SchemaFormat`.
  - `Schema` has the following properties: `properties` and `definition`.
  - `SchemaFormat` provides the schema format to be stored by the service. Currently, the only supported format is `Avro`.
  - `api_version` has been added as a keyword arg to the sync and async `SchemaRegistryClient` constructors.



  - `version` instance variable in `SchemaProperties` has been removed.
  - `schema_definition` instance variable in `Schema` has been renamed `definition`.
  - `id` parameter in `get_schema` method on sync and async `SchemaRegistryClient` has been renamed `schema_id`.
  - `schema_definition` parameter in `register_schema` and `get_schema_properties` methods on sync and async `SchemaRegistryClient` has been renamed `definition`.
  - `serializer` namespace has been removed from `azure.schemaregistry`.





  - `get_schema_id` method on sync and async `SchemaRegistryClient` has been renamed `get_schema_properties`.
  - `schema_id` parameter in `get_schema` method on sync and async `SchemaRegistryClient` has been renamed `id`.
  - `register_schema` and `get_schema_properties` methods on sync and async `SchemaRegistryClient` now take in the following parameters in the given order:
    - `group_name`, which has been renamed from `schema_group`
    - `name`, which has been renamed from `schema_name`
    - `schema_definition`, which has been renamed from `schema_content`
    - `format`, which has been renamed from `serialization_type`
  - `endpoint` parameter in `SchemaRegistryClient` constructor has been renamed `fully_qualified_namespace`
  - `location` instance variable in `SchemaProperties` has been removed.
  - `Schema` and `SchemaProperties` no longer have positional parameters, as they will not be constructed by the user.



  - Updated azure-core dependency to 1.19.0.
  - Removed caching support of registered schemas so requests are sent to the service to register schemas, get schema properties, and get schemas.



  This version and all future versions will require Python 2.7 or Python 3.6+, Python 3.5 is no longer supported.



  - Support caching of registered schemas and send requests to the service only if the cache does not have the looked-up schema/schema ID.



  Version 1.0.0b1 is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Schema Registry.

  **New features**

  - `SchemaRegistryClient` is the top-level client class interacting with the Azure Schema Registry Service. It provides three methods:
    - `register_schema`: Store schema into the service.
    - `get_schema`: Get schema content and its properties by schema id.
    - `get_schema_id`: Get schema id and its properties by schema group, schema name, serialization type and schema content.


pkgId: bcd46532622a4b3df48f0e9954b04fa93c903135ce0d10505591c0fa81a714d6
name: python-azure-schemaregistry-avroencoder
arch: src
version: 1.0.0
epoch: 0
release: 1
summary: Microsoft Azure Schema Registry Avro Encoder Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-schemaregistry-avroencoder-1.0.0-1.src.rpm
checksum_type: sha256
description:
  Azure Schema Registry is a schema repository service hosted by Azure Event Hubs, providing schema storage, versioning,
  and management. This package provides an Avro encoder capable of encoding and decoding payloads containing
  Schema Registry schema identifiers and Avro-encoded content.

  [Source code][source_code] | [Package (PyPi)][pypi] | [API reference documentation][api_reference] | [Samples][sr_avro_samples] | [Changelog][change_log]



  _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_





  Install the Azure Schema Registry Avro Encoder client library for Python with [pip][pip]:

  ```Bash
  pip install azure-schemaregistry-avroencoder
  ```


  To use this package, you must have:
  * Azure subscription - [Create a free account][azure_sub]
  * [Azure Schema Registry][schemaregistry_service] - [Here is the quickstart guide][quickstart_guide] to create a Schema Registry group using the Azure portal.
  * Python 3.6 or later - [Install Python][python]


  Interaction with the Schema Registry Avro Encoder starts with an instance of AvroEncoder class, which takes the schema group name and the [Schema Registry Client][schemaregistry_client] class. The client constructor takes the Event Hubs fully qualified namespace and and Azure Active Directory credential:

  * The fully qualified namespace of the Schema Registry instance should follow the format: `<yournamespace>.servicebus.windows.net`.

  * An AAD credential that implements the [TokenCredential][token_credential_interface] protocol should be passed to the constructor. There are implementations of the `TokenCredential` protocol available in the
  [azure-identity package][pypi_azure_identity]. To use the credential types provided by `azure-identity`, please install the Azure Identity client library for Python with [pip][pip]:

  ```Bash
  pip install azure-identity
  ```

  * Additionally, to use the async API, you must first install an async transport, such as [aiohttp](https://pypi.org/project/aiohttp/):

  ```Bash
  pip install aiohttp
  ```

  **Create AvroEncoder using the azure-schemaregistry library:**

  ```python
  import os
  from azure.schemaregistry import SchemaRegistryClient
  from azure.schemaregistry.encoder.avroencoder import AvroEncoder
  from azure.identity import DefaultAzureCredential

  credential = DefaultAzureCredential()

  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_FULLY_QUALIFIED_NAMESPACE']
  group_name = os.environ['SCHEMAREGISTRY_GROUP']
  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace, credential)
  encoder = AvroEncoder(client=schema_registry_client, group_name=group_name)
  ```





  Provides API to encode to and decode from Avro Binary Encoding plus a
  content type with schema ID. Uses [SchemaRegistryClient][schemaregistry_client] to get schema IDs from schema content or vice versa.



  Support has been added to certain Azure Messaging SDK model classes for interoperability with the `AvroEncoder`. These models are subtypes of the `MessageType` protocol defined under the `azure.schemaregistry.encoder.avroencoder` namespace. Currently, the supported model classes are:

  - `azure.eventhub.EventData` for `azure-eventhub>=5.9.0`



  If a message type that follows the MessageType protocol is provided to the encoder for encoding, it will set the corresponding content and content type properties, where:

  - `content`: Avro payload (in general, format-specific payload)
    - Avro Binary Encoding
    - NOT Avro Object Container File, which includes the schema and defeats the
      purpose of this encoder to move the schema out of the message payload and
      into the schema registry.

  - `content type`: a string of the format `avro/binary+<schema ID>`, where:
    - `avro/binary` is the format indicator
    - `<schema ID>` is the hexadecimal representation of GUID, same format and byte order as the string from the Schema Registry service.

  If `EventData` is passed in as the message type, the following properties will be set on the `EventData` object:
   - The `body` property will be set to the content value.
   - The `content_type` property will be set to the content type value.

  If message type is not provided, and by default, the encoder will create the following dict:
  `{"content": <Avro encoded payload>, "content_type": 'avro/binary+<schema ID>' }`



  The following sections provide several code snippets covering some of the most common Schema Registry tasks, including:

  - [Encoding](#encoding)
  - [Decoding](#decoding)
  - [Event Hubs Sending Integration](#event-hubs-sending-integration)
  - [Event Hubs Receiving Integration](#event-hubs-receiving-integration)



  Use the `AvroEncoder.encode` method to encode content with the given Avro schema.
  The method will use a schema previously registered to the Schema Registry service and keep the schema cached for future encoding usage. In order to avoid pre-registering the schema to the service and automatically register it with the `encode` method, the keyword argument `auto_register=True` should be passed to the `AvroEncoder` constructor.

  ```python
  import os
  from azure.schemaregistry import SchemaRegistryClient
  from azure.schemaregistry.encoder.avroencoder import AvroEncoder
  from azure.identity import DefaultAzureCredential
  from azure.eventhub import EventData

  token_credential = DefaultAzureCredential()
  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_FULLY_QUALIFIED_NAMESPACE']
  group_name = os.environ['SCHEMAREGISTRY_GROUP']
  name = "example.avro.User"
  format = "Avro"

  definition = """
  {"namespace": "example.avro",
   "type": "record",
   "name": "User",
   "fields": [
       {"name": "name", "type": "string"},
       {"name": "favorite_number",  "type": ["int", "null"]},
       {"name": "favorite_color", "type": ["string", "null"]}
   ]
  }"""

  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace, token_credential)
  schema_registry_client.register_schema(group_name, name, definition, format)
  encoder = AvroEncoder(client=schema_registry_client, group_name=group_name)

  with encoder:
      dict_content = {"name": "Ben", "favorite_number": 7, "favorite_color": "red"}
      event_data = encoder.encode(dict_content, schema=definition, message_type=EventData)

      

      message_content_dict = encoder.encode(dict_content, schema=definition)
      event_data = EventData.from_message_content(message_content_dict["content"], message_content_dict["content_type"])
  ```



  Use the `AvroEncoder.decode` method to decode the Avro-encoded content by either:
   - Passing in a message object that is a subtype of the MessageType protocol.
   - Passing in a dict with keys `content`(type bytes) and `content_type` (type string).
  The method automatically retrieves the schema from the Schema Registry Service and keeps the schema cached for future decoding usage.

  ```python
  import os
  from azure.schemaregistry import SchemaRegistryClient
  from azure.schemaregistry.encoder.avroencoder import AvroEncoder
  from azure.identity import DefaultAzureCredential

  token_credential = DefaultAzureCredential()
  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_FULLY_QUALIFIED_NAMESPACE']
  group_name = "<your-group-name>"

  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace, token_credential)
  encoder = AvroEncoder(client=schema_registry_client)

  with encoder:
      
      dict_content = {"name": "Ben", "favorite_number": 7, "favorite_color": "red"}
      event_data = encoder.encode(dict_content, schema=definition, message_type=EventData)
      decoded_content = encoder.decode(event_data)

      

      encoded_bytes = b'<content_encoded_by_azure_schema_registry_avro_encoder>'
      content_type = 'avro/binary+<schema_id_of_corresponding_schema>'
      content_dict = {"content": encoded_bytes, "content_type": content_type}
      decoded_content = encoder.decode(content_dict)
  ```



  Integration with [Event Hubs][eventhubs_repo] to send an `EventData` object with `body` set to Avro-encoded content and corresponding `content_type`.

  ```python
  import os
  from azure.eventhub import EventHubProducerClient, EventData
  from azure.schemaregistry import SchemaRegistryClient
  from azure.schemaregistry.encoder.avroencoder import AvroEncoder
  from azure.identity import DefaultAzureCredential

  token_credential = DefaultAzureCredential()
  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_FULLY_QUALIFIED_NAMESPACE']
  group_name = os.environ['SCHEMAREGISTRY_GROUP']
  eventhub_connection_str = os.environ['EVENT_HUB_CONN_STR']
  eventhub_name = os.environ['EVENT_HUB_NAME']

  definition = """
  {"namespace": "example.avro",
   "type": "record",
   "name": "User",
   "fields": [
       {"name": "name", "type": "string"},
       {"name": "favorite_number",  "type": ["int", "null"]},
       {"name": "favorite_color", "type": ["string", "null"]}
   ]
  }"""

  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace, token_credential)
  avro_encoder = AvroEncoder(client=schema_registry_client, group_name=group_name, auto_register=True)

  eventhub_producer = EventHubProducerClient.from_connection_string(
      conn_str=eventhub_connection_str,
      eventhub_name=eventhub_name
  )

  with eventhub_producer, avro_encoder:
      event_data_batch = eventhub_producer.create_batch()
      dict_content = {"name": "Bob", "favorite_number": 7, "favorite_color": "red"}
      event_data = avro_encoder.encode(dict_content, schema=definition, message_type=EventData)
      event_data_batch.add(event_data)
      eventhub_producer.send_batch(event_data_batch)
  ```



  Integration with [Event Hubs][eventhubs_repo] to receive an `EventData` object and decode the the Avro-encoded `body` value.

  ```python
  import os
  from azure.eventhub import EventHubConsumerClient
  from azure.schemaregistry import SchemaRegistryClient
  from azure.schemaregistry.encoder.avroencoder import AvroEncoder
  from azure.identity import DefaultAzureCredential

  token_credential = DefaultAzureCredential()
  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_FULLY_QUALIFIED_NAMESPACE']
  group_name = os.environ['SCHEMAREGISTRY_GROUP']
  eventhub_connection_str = os.environ['EVENT_HUB_CONN_STR']
  eventhub_name = os.environ['EVENT_HUB_NAME']

  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace, token_credential)
  avro_encoder = AvroEncoder(client=schema_registry_client, group_name=group_name)

  eventhub_consumer = EventHubConsumerClient.from_connection_string(
      conn_str=eventhub_connection_str,
      consumer_group='$Default',
      eventhub_name=eventhub_name,
  )

  def on_event(partition_context, event):
      decoded_content = avro_encoder.decode(event)

  with eventhub_consumer, avro_encoder:
      eventhub_consumer.receive(on_event=on_event, starting_position="-1")
  ```





  Azure Schema Registry Avro Encoder raises exceptions defined in [Azure Core][azure_core] if errors are encountered when communicating with the Schema Registry service. Errors related to invalid content/content types and invalid schemas will be raised as `azure.schemaregistry.encoder.avroencoder.InvalidContentError` and `azure.schemaregistry.encoder.avroencoder.InvalidSchemaError`, respectively, where `__cause__` will contain the underlying exception raised by the Apache Avro library.


  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` argument:
  ```python
  import sys
  import os
  import logging
  from azure.schemaregistry import SchemaRegistryClient
  from azure.schemaregistry.encoder.avroencoder import AvroEncoder
  from azure.identity import DefaultAzureCredential


  logger = logging.getLogger('azure.schemaregistry')
  logger.setLevel(logging.DEBUG)


  handler = logging.StreamHandler(stream=sys.stdout)
  logger.addHandler(handler)

  fully_qualified_namespace = os.environ['SCHEMAREGISTRY_FULLY_QUALIFIED_NAMESPACE']
  group_name = os.environ['SCHEMAREGISTRY_GROUP']
  credential = DefaultAzureCredential()
  schema_registry_client = SchemaRegistryClient(fully_qualified_namespace, credential, logging_enable=True)

  encoder = AvroEncoder(client=schema_registry_client, group_name=group_name)
  ```

  Similarly, `logging_enable` can enable detailed logging for a single operation,
  even when it isn't enabled for the client:
  ```py
  encoder.encode(dict_content, schema=definition, logging_enable=True)
  ```





  Further examples demonstrating common Azure Schema Registry Avro Encoder scenarios are in the [samples][sr_avro_samples] directory.



  This project welcomes contributions and suggestions.  Most contributions require you to agree to a
  Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
  the rights to use your contribution. For details, visit https://cla.microsoft.com.

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
  a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
  provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
  For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
  contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

  <!-- LINKS -->
  [pip]: https://pypi.org/project/pip/
  [pypi]: https://pypi.org/project/azure-schemaregistry-avroencoder/
  [python]: https://www.python.org/downloads/
  [azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [azure_sub]: https://azure.microsoft.com/free/
  [python_logging]: https://docs.python.org/3/library/logging.html
  [sr_avro_samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/schemaregistry/azure-schemaregistry-avroencoder/samples
  [api_reference]: https://docs.microsoft.com/python/api/overview/azure/schemaregistry-avroencoder-readme
  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/schemaregistry/azure-schemaregistry-avroencoder
  [change_log]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/schemaregistry/azure-schemaregistry-avroencoder/CHANGELOG.md
  [schemaregistry_client]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/schemaregistry/azure-schemaregistry
  [schemaregistry_service]: https://aka.ms/schemaregistry
  [eventhubs_repo]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/eventhub/azure-eventhub
  [token_credential_interface]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core/azure/core/credentials.py
  [pypi_azure_identity]: https://pypi.org/project/azure-identity/
  [quickstart_guide]: https://docs.microsoft.com/azure/event-hubs/create-schema-registry





  **Note:** This is the first stable release of our efforts to create a user-friendly Pythonic Avro Encoder library that integrates with the Python client library for Azure Schema Registry.



  - `AvroEncoder` sync and async classes provide the functionality to encode and decode content which follows a schema with the RecordSchema format, as defined by the Apache Avro specification. The Apache Avro library is used as the implementation for encoding and decoding.
  The encoder will automatically register and retrieve schemas from Azure Schema Registry Service. It provides the following methods:
    - constructor: If `auto_register=True` keyword is passed in, will automatically register schemas passed in to the `encode` method. Otherwise, and by default, will require pre-registering of schemas passed to `encode`. Takes a `group_name` argument that is optional when decoding, but required for encoding.
    - `encode`: Encodes dict content into bytes according to the given schema and registers schema if needed. Returns either a dict of encoded content and corresponding content type or a `MessageType` subtype object, depending on arguments provided.
    - `decode`: Decodes bytes content into dict content by automatically retrieving schema from the service.
  - `MessageContent` TypedDict has been introduced with the following required keys:
    - `content`: The bytes content.
    - `content_type`: The string content type, which holds the schema ID and the record format indicator.
  - `MessageType` has been introduced with the following methods:
    - `from_message_content`: Class method that creates an object with given bytes content and string content type.
    - `__message_content__`: Returns a `MessageContent` object with content and content type values set to their respective properties on the object.
  - Schemas and Schema IDs are cached locally, so that multiple calls with the same schema/schema ID will not trigger multiple service calls.
  - The number of hits, misses, and total entries for the schema/schema ID caches will be logged at an info level when a new entry is added.
  - `InvalidContentError` has been introduced for errors related to invalid content and content types, where `__cause__` will contain the underlying exception raised by the Avro library.
  - `InvalidSchemaError` has been introduced for errors related to invalid schemas, where `__cause__` will contain the underlying exception raised by the Apache Avro library.
  - The `encode` and `decode` methods on `AvroEncoder` support the following message models:
    - `azure.eventhub.EventData` in `azure-eventhub>=5.9.0`



  - This package is meant to replace the azure-schemaregistry-avroserializer package, which will no longer be supported.
  - `group_name` is now an optional parameter in the sync and async `AvroEncoder` constructors.





  - `auto_register_schemas` keyword in the sync and async `AvroEncoder` constructors has been renamed `auto_register`.
  - `SchemaParseError`, `SchemaEncodeError`, and `SchemaDecodeError` have been replaced with `InvalidContentError` and `InvalidSchemaError`. The errors have been added under the `azure.schemaregistry.encoder.avroencoder` namespace.
  - The `exceptions` module in `azure.schemaregistry.encoder.avroencoder` has been removed.
  - The `encode` method on the sync and async `AvroEncoder` only allows subtypes of the `MessageType` protocol as values to the `message_type` optional parameter, rather than any callable that has the method signature `(content: bytes, content_type: str, **kwargs: Any)`.
  - The number of hits/misses, in addition to number of entries, for the schema/schema ID caches will be logged at an info level when a new entry is added.



  - This release and future releases will not have backward compatibility support for decoding data that was encoded with the AvroSerializer.
  - The `encode` and `decode` methods on `AvroEncoder` support the following message models:
    - `azure.eventhub.EventData` in `azure-eventhub==5.9.0b3`





  - `request_options` has been added to `encode` and `decode` on `AvroEncoder` as an optional parameter to be passed into client requests.
  - The size of the current schema/schema ID caches will be logged at an info level when a new entry has been added.



  - `MessageMetadataDict` has been renamed `MessageContent`.
  - `data` in `MessageContent` has been renamed `content`.
  - The `data` parameter in `encode` and `decode` on the sync and async `AvroEncoder` has been renamed `content`.
  - The `from_message_data` method in the `MessageType` protocol has been renamed `from_message_content`. The `data` parameter in `from_message_content` has been renamed `content`.
  - The `__message_data__` method in the `MessageType` protocol has been renamed `__message_content__`.



  - This beta release will be backward compatible for decoding data that was encoded with the AvroSerializer.
  - The `encode` and `decode` methods on `AvroEncoder` support the following message models:
    - `azure.eventhub.EventData` in `azure-eventhub==5.9.0b2`



  This version and all future versions will require Python 3.6+. Python 2.7 is no longer supported.



  - This package is meant to replace the azure-schemaregistry-avroserializer.
  - APIs have been updated to allow for encoding directly to and decoding from message type objects, where the data value is the Avro encoded payload.
  - The content type of the message will hold the schema ID and record format indicator.



  - This beta release will be backward compatible for decoding data that was encoded with the AvroSerializer.
  - The `encode` and `decode` methods on `AvroEncoder` support the following message models:
    - `azure.eventhub.EventData` in `azure-eventhub==5.9.0b1`


pkgId: d63dd205426c6bdc3eccd6b74b8cf02f5552faaea1a303d63b68601017bef325
name: python-azure-schemaregistry-avroserializer
arch: src
version: 1.0.0b4.post1
epoch: 0
release: 1
summary: Microsoft Azure Schema Registry Avro Serializer Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-schemaregistry-avroserializer-1.0.0b4.post1-1.src.rpm
checksum_type: sha256
description:
  This package is no longer being maintained. Use the [azure-schemaregistry-avroencoder](https://pypi.org/project/azure-schemaregistry-avroencoder/) package instead.

  For migration instructions, see the [migration guide](https://aka.ms/azsdk/python/migrate/sr-avroserializer-to-avroencoder).






  This package is no longer being maintained. Use the [azure-schemaregistry-avroencoder](https://pypi.org/project/azure-schemaregistry-avroencoder/) package instead.

  For migration instructions, see the [migration guide](https://aka.ms/azsdk/python/migrate/sr-avroserializer-to-avroencoder).





  - Async version of `AvroSerializer` has been added under `azure.schemaregistry.serializer.avroserializer.aio`.
  - Depends on `azure-schemaregistry>=1.0.0,<2.0.0`.



  - `SchemaParseError`, `SchemaSerializationError`, and `SchemaDeserializationError` have been introduced under `azure.schemaregistry.serializer.avroserializer.exceptions` and will be raised for corresponding operations.
    - `SchemaParseError` and `SchemaSerializationError` may be raised for errors when calling `serialize` on `AvroSerializer`.
    - `SchemaParseError` and `SchemaDeserializationError` may be raised for errors when calling `deserialize` on `AvroSerializer`.





  - `auto_register_schemas` keyword argument has been added to `AvroSerializer`, which will allow for automatically registering schemas passed in to the `serialize`, when set to `True`, otherwise `False` by default.
  - `value` parameter in `serialize` on `AvroSerializer` takes type `Mapping` rather than `Dict`.
  - Depends on `azure-schemaregistry==1.0.0b3`.



  - `SchemaRegistryAvroSerializer` has been renamed `AvroSerializer`.
  - `schema_registry` parameter in the `AvroSerializer` constructor has been renamed `client`.
  - `schema_group` parameter in the `AvroSerializer` constructor has been renamed `group_name`.
  - `data` parameter in the `serialize` and `deserialize` methods on `AvroSerializer` has been renamed `value`.
  - `schema` parameter in the `serialize` method on `AvroSerializer` no longer accepts argument of type `bytes`.
  - `AvroSerializer` constructor no longer takes in the `codec` keyword argument.
  - The following positional arguments are now required keyword arguments:
    - `client` and `group_name` in `AvroSerializer` constructor
    - `schema` in `serialize` on `AvroSerializer`



  This version and all future versions will require Python 2.7 or Python 3.6+, Python 3.5 is no longer supported.



  - Depends on `azure-schemaregistry==1.0.0b2` which supports client-level caching.



  Version 1.0.0b1 is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Schema Registry Avro Serializer.

  **New features**

  - `SchemaRegistryAvroSerializer` is the top-level client class that provides the functionality to encode and decode avro data utilizing the avro library. It will automatically register schema and retrieve schema from Azure Schema Registry Service. It provides two methods:
    - `serialize`: Serialize dict data into bytes according to the given schema and register schema if needed.
    - `deserialize`: Deserialize bytes data into dict data by automatically retrieving schema from the service.


pkgId: 93cbf8407cc26dfa9834fce8834ce5ba102ab86baee5835e954bf00edf5c88f3
name: python-azure-search
arch: src
version: 1.0.0b2
epoch: 0
release: 1
summary: Microsoft Azure Cognitive Search Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/search/azure-search
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-search-1.0.0b2-1.src.rpm
checksum_type: sha256
description:
  This package was the Microsoft Azure Cognitive Search client library.

  It is deprecated.

  The new package can be found at: https://pypi.org/project/azure-search-documents/.


pkgId: 72914d257a105788697d908492f8695f57cb8ef76d04426ddcbabad814054c78
name: python-azure-search-documents
arch: src
version: 11.5.1
epoch: 0
release: 1
summary: Microsoft Azure Cognitive Search Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/search/azure-search-documents
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-search-documents-11.5.1-1.src.rpm
checksum_type: sha256
description:
  [Azure AI Search](https://docs.microsoft.com/azure/search/) (formerly known as "Azure Cognitive Search") is an AI-powered information retrieval platform that helps developers build rich search experiences and generative AI apps that combine large language models with enterprise data.

  Azure AI Search is well suited for the following application scenarios:

  * Consolidate varied content types into a single searchable index.
    To populate an index, you can push JSON documents that contain your content,
    or if your data is already in Azure, create an indexer to pull in data
    automatically.
  * Attach skillsets to an indexer to create searchable content from images
    and unstructured documents. A skillset leverages APIs from Azure AI Services
    for built-in OCR, entity recognition, key phrase extraction, language
    detection, text translation, and sentiment analysis. You can also add
    custom skills to integrate external processing of your content during
    data ingestion.
  * In a search client application, implement query logic and user experiences
    similar to commercial web search engines and chat-style apps.

  Use the Azure.Search.Documents client library to:

  * Submit queries using vector, keyword, and hybrid query forms.
  * Implement filtered queries for metadata, geospatial search, faceted navigation,
    or to narrow results based on filter criteria.
  * Create and manage search indexes.
  * Upload and update documents in the search index.
  * Create and manage indexers that pull data from Azure into an index.
  * Create and manage skillsets that add AI enrichment to data ingestion.
  * Create and manage analyzers for advanced text analysis or multi-lingual content.
  * Optimize results through semantic ranking and scoring profiles to factor in business logic or freshness.

  [Source code](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/search/azure-search-documents)
  | [Package (PyPI)](https://pypi.org/project/azure-search-documents/)
  | [Package (Conda)](https://anaconda.org/microsoft/azure-search-documents/)
  | [API reference documentation](https://azuresdkdocs.blob.core.windows.net/$web/python/azure-search-documents/latest/index.html)
  | [Product documentation](https://docs.microsoft.com/azure/search/search-what-is-azure-search)
  | [Samples](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples)





  Install the Azure AI Search client library for Python with [pip](https://pypi.org/project/pip/):

  ```bash
  pip install azure-search-documents
  ```



  * Python 3.8 or later is required to use this package.
  * You need an [Azure subscription][azure_sub] and an
  [Azure AI Search service][search_resource] to use this package.

  To create a new search service, you can use the [Azure portal][create_search_service_docs], [Azure PowerShell][create_search_service_ps], or the [Azure CLI][create_search_service_cli].

  ```Powershell
  az search service create --name <mysearch> --resource-group <mysearch-rg> --sku free --location westus
  ```

  See [choosing a pricing tier](https://docs.microsoft.com/azure/search/search-sku-tier)
   for more information about available options.



  To interact with the search service, you'll need to create an instance of the appropriate client class: `SearchClient` for searching indexed documents, `SearchIndexClient` for managing indexes, or `SearchIndexerClient` for crawling data sources and loading search documents into an index. To instantiate a client object, you'll need an **endpoint** and **Azure roles** or an **API key**. You can refer to the documentation for more information on [supported authenticating approaches](https://learn.microsoft.com/azure/search/search-security-overview#authentication) with the search service.



  An API key can be an easier approach to start with because it doesn't require pre-existing role assignments.

  You can get the **endpoint** and an **API key** from the Search service in the [Azure portal](https://portal.azure.com/). Please refer the [documentation](https://docs.microsoft.com/azure/search/search-security-api-keys) for instructions on how to get an API key.

  Alternatively, you can use the following [Azure CLI](https://learn.microsoft.com/cli/azure/) command to retrieve the API key from the Search service:

  ```Powershell
  az search admin-key show --service-name <mysearch> --resource-group <mysearch-rg>
  ```

  There are two types of keys used to access your search service: **admin**
  *(read-write)* and **query** *(read-only)* keys.  Restricting access and
  operations in client apps is essential to safeguarding the search assets on your
  service.  Always use a query key rather than an admin key for any query
  originating from a client app.

  *Note: The example Azure CLI snippet above retrieves an admin key so it's easier
  to get started exploring APIs, but it should be managed carefully.*



  To instantiate the `SearchClient`, you'll need the **endpoint**, **API key** and **index name**:

  <!-- SNIPPET:sample_authentication.create_search_client_with_key -->

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.search.documents import SearchClient

  service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"]
  index_name = os.environ["AZURE_SEARCH_INDEX_NAME"]
  key = os.environ["AZURE_SEARCH_API_KEY"]

  search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key))
  ```

  <!-- END SNIPPET -->



  You can also create a `SearchClient`, `SearchIndexClient`, or `SearchIndexerClient` using Microsoft Entra ID authentication. Your user or service principal must be assigned the "Search Index Data Reader" role.
  Using the [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/README.md#defaultazurecredential) you can authenticate a service using Managed Identity or a service principal, authenticate as a developer working on an application, and more all without changing code. Please refer the [documentation](https://learn.microsoft.com/azure/search/search-security-rbac?tabs=config-svc-portal%2Croles-portal%2Ctest-portal%2Ccustom-role-portal%2Cdisable-keys-portal) for instructions on how to connect to Azure AI Search using Azure role-based access control (Azure RBAC).

  Before you can use the `DefaultAzureCredential`, or any credential type from [Azure.Identity](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/README.md), you'll first need to [install the Azure.Identity package](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/README.md#install-the-package).

  To use `DefaultAzureCredential` with a client ID and secret, you'll need to set the `AZURE_TENANT_ID`, `AZURE_CLIENT_ID`, and `AZURE_CLIENT_SECRET` environment variables; alternatively, you can pass those values
  to the `ClientSecretCredential` also in Azure.Identity.

  Make sure you use the right namespace for `DefaultAzureCredential` at the top of your source file:

  ```python
  from azure.identity import DefaultAzureCredential
  from azure.search.documents import SearchClient

  service_endpoint = os.getenv("AZURE_SEARCH_SERVICE_ENDPOINT")
  index_name = os.getenv("AZURE_SEARCH_INDEX_NAME")
  credential = DefaultAzureCredential()

  search_client = SearchClient(service_endpoint, index_name, credential)
  ```



  An Azure AI Search service contains one or more indexes that provide
  persistent storage of searchable data in the form of JSON documents.  _(If
  you're brand new to search, you can make a very rough analogy between
  indexes and database tables.)_  The Azure.Search.Documents client library
  exposes operations on these resources through three main client types.

  * `SearchClient` helps with:
    * [Searching](https://docs.microsoft.com/azure/search/search-lucene-query-architecture)
      your indexed documents using [vector queries](https://learn.microsoft.com/azure/search/vector-search-how-to-query),
      [keyword queries](https://learn.microsoft.com/azure/search/search-query-create)
      and [hybrid queries](https://learn.microsoft.com/azure/search/hybrid-search-how-to-query)
    * [Vector query filters](https://learn.microsoft.com/azure/search/vector-search-filters) and [Text query filters](https://learn.microsoft.com/azure/search/search-filters)
    * [Semantic ranking](https://learn.microsoft.com/azure/search/semantic-how-to-query-request) and [scoring profiles](https://learn.microsoft.com/azure/search/index-add-scoring-profiles) for boosting relevance
    * [Autocompleting](https://docs.microsoft.com/rest/api/searchservice/autocomplete)
      partially typed search terms based on documents in the index
    * [Suggesting](https://docs.microsoft.com/rest/api/searchservice/suggestions)
      the most likely matching text in documents as a user types
    * [Adding, Updating or Deleting Documents](https://docs.microsoft.com/rest/api/searchservice/addupdate-or-delete-documents)
      documents from an index

  * `SearchIndexClient` allows you to:
    * [Create, delete, update, or configure a search index](https://docs.microsoft.com/rest/api/searchservice/index-operations)
    * [Declare custom synonym maps to expand or rewrite queries](https://docs.microsoft.com/rest/api/searchservice/synonym-map-operations)
  <!--   * Most of the `SearchServiceClient` functionality is not yet available in our current preview -->

  * `SearchIndexerClient` allows you to:
    * [Start indexers to automatically crawl data sources](https://docs.microsoft.com/rest/api/searchservice/indexer-operations)
    * [Define AI powered Skillsets to transform and enrich your data](https://docs.microsoft.com/rest/api/searchservice/skillset-operations)

  Azure AI Search provides two powerful features: **semantic ranking** and **vector search**.

  **Semantic ranking** enhances the quality of search results for text-based queries. By enabling semantic ranking on your search service, you can improve the relevance of search results in two ways:
  - It applies secondary ranking to the initial result set, promoting the most semantically relevant results to the top.
  - It extracts and returns captions and answers in the response, which can be displayed on a search page to enhance the user's search experience.

  To learn more about semantic ranking, you can refer to the [documentation](https://learn.microsoft.com/azure/search/vector-search-overview).

  **Vector search** is an information retrieval technique that uses numeric representations of searchable documents and query strings. By searching for numeric representations of content that are most similar to the numeric query, vector search can find relevant matches, even if the exact terms of the query are not present in the index. Moreover, vector search can be applied to various types of content, including images and videos and translated text, not just same-language text.

  To learn how to index vector fields and perform vector search, you can refer to the [sample](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_vector_search.py). This sample provides detailed guidance on indexing vector fields and demonstrates how to perform vector search.

  Additionally, for more comprehensive information about vector search, including its concepts and usage, you can refer to the [documentation](https://learn.microsoft.com/azure/search/vector-search-overview). The documentation provides in-depth explanations and guidance on leveraging the power of vector search in Azure AI Search.

  _The `Azure.Search.Documents` client library (v1) provides APIs for data plane operations. The
  previous `Microsoft.Azure.Search` client library (v10) is now retired. It has many similar looking APIs, so please be careful to avoid confusion when exploring online resources. A good rule of thumb is to check for the namespace
  `Azure.Search.Documents;` when you're looking for API reference.



  The following examples all use a simple [Hotel data set](https://github.com/Azure-Samples/azure-search-sample-data/blob/master/README.md)
  that you can [import into your own index from the Azure portal.](https://docs.microsoft.com/azure/search/search-get-started-portal#step-1---start-the-import-data-wizard-and-create-a-data-source)
  These are just a few of the basics - please [check out our Samples](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples) for
  much more.


  * [Querying](#querying)
  * [Creating an index](#creating-an-index)
  * [Adding documents to your index](#adding-documents-to-your-index)
  * [Retrieving a specific document from your index](#retrieving-a-specific-document-from-your-index)
  * [Async APIs](#async-apis)




  Let's start by importing our namespaces.

  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.search.documents import SearchClient
  ```

  We'll then create a `SearchClient` to access our hotels search index.

  ```python
  index_name = "hotels"

  endpoint = os.environ["SEARCH_ENDPOINT"]
  key = os.environ["SEARCH_API_KEY"]


  credential = AzureKeyCredential(key)
  client = SearchClient(endpoint=endpoint,
                        index_name=index_name,
                        credential=credential)
  ```

  Let's search for a "luxury" hotel.

  ```python
  results = client.search(search_text="luxury")

  for result in results:
      print("{}: {})".format(result["hotelId"], result["hotelName"]))
  ```




  You can use the `SearchIndexClient` to create a search index. Fields can be
  defined using convenient `SimpleField`, `SearchableField`, or `ComplexField`
  models. Indexes can also define suggesters, lexical analyzers, and more.

  <!-- SNIPPET:sample_index_crud_operations.create_index -->

  ```python
  client = SearchIndexClient(service_endpoint, AzureKeyCredential(key))
  name = "hotels"
  fields = [
      SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True),
      SimpleField(name="baseRate", type=SearchFieldDataType.Double),
      SearchableField(name="description", type=SearchFieldDataType.String, collection=True),
      ComplexField(
          name="address",
          fields=[
              SimpleField(name="streetAddress", type=SearchFieldDataType.String),
              SimpleField(name="city", type=SearchFieldDataType.String),
          ],
          collection=True,
      ),
  ]
  cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60)
  scoring_profiles: List[ScoringProfile] = []
  index = SearchIndex(name=name, fields=fields, scoring_profiles=scoring_profiles, cors_options=cors_options)

  result = client.create_index(index)
  ```

  <!-- END SNIPPET -->



  You can `Upload`, `Merge`, `MergeOrUpload`, and `Delete` multiple documents from
  an index in a single batched request.  There are
  [a few special rules for merging](https://docs.microsoft.com/rest/api/searchservice/addupdate-or-delete-documents#document-actions)
  to be aware of.

  <!-- SNIPPET:sample_crud_operations.upload_document -->

  ```python
  DOCUMENT = {
      "category": "Hotel",
      "hotelId": "1000",
      "rating": 4.0,
      "rooms": [],
      "hotelName": "Azure Inn",
  }

  result = search_client.upload_documents(documents=[DOCUMENT])

  print("Upload of new document succeeded: {}".format(result[0].succeeded))
  ```

  <!-- END SNIPPET -->



  To authenticate in a [National Cloud](https://docs.microsoft.com/azure/active-directory/develop/authentication-national-cloud), you will need to make the following additions to your client configuration:

  - Set the `AuthorityHost` in the credential options or via the `AZURE_AUTHORITY_HOST` environment variable
  - Set the `audience` in `SearchClient`, `SearchIndexClient`, or `SearchIndexerClient`

  ```python

  import os
  from azure.identity import DefaultAzureCredential, AzureAuthorityHosts
  from azure.search.documents import SearchClient

  index_name = "hotels"
  endpoint = os.environ["SEARCH_ENDPOINT"]
  key = os.environ["SEARCH_API_KEY"]
  credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_CHINA)

  search_client = SearchClient(endpoint, index_name, credential=credential, audience="https://search.azure.cn")
  ```



  In addition to querying for documents using keywords and optional filters,
  you can retrieve a specific document from your index if you already know the
  key. You could get the key from a query, for example, and want to show more
  information about it or navigate your customer to that document.

  <!-- SNIPPET:sample_get_document.get_document -->

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.search.documents import SearchClient

  search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key))

  result = search_client.get_document(key="23")

  print("Details for hotel '23' are:")
  print("        Name: {}".format(result["hotelName"]))
  print("      Rating: {}".format(result["rating"]))
  print("    Category: {}".format(result["category"]))
  ```

  <!-- END SNIPPET -->



  This library includes a complete async API. To use it, you must
  first install an async transport, such as [aiohttp](https://pypi.org/project/aiohttp/).
  See
  [azure-core documentation](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md#transport)
  for more information.

  <!-- SNIPPET:sample_simple_query_async.simple_query_async -->

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.search.documents.aio import SearchClient

  search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key))

  async with search_client:
      results = await search_client.search(search_text="spa")

      print("Hotels containing 'spa' in the name (or other fields):")
      async for result in results:
          print("    Name: {} (rating {})".format(result["hotelName"], result["rating"]))
  ```

  <!-- END SNIPPET -->





  The Azure AI Search client will raise exceptions defined in [Azure Core][azure_core].



  This library uses the standard [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` keyword argument:
  ```python
  import sys
  import logging
  from azure.core.credentials import AzureKeyCredential
  from azure.search.documents import SearchClient


  logger = logging.getLogger('azure')
  logger.setLevel(logging.DEBUG)


  handler = logging.StreamHandler(stream=sys.stdout)
  logger.addHandler(handler)


  client = SearchClient("<service endpoint>", "<index_name>", AzureKeyCredential("<api key>"), logging_enable=True)

  ```

  Similarly, `logging_enable` can enable detailed logging for a single operation,
  even when it isn't enabled for the client:
  ```python
  result =  client.search(search_text="spa", logging_enable=True)
  ```



  * Go further with Azure.Search.Documents and our [https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/search/azure-search-documents/samples](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples)
  * Read more about the [Azure AI Search service](https://docs.microsoft.com/azure/search/search-what-is-azure-search)



  See our [Search CONTRIBUTING.md][search_contrib] for details on building,
  testing, and contributing to this library.

  This project welcomes contributions and suggestions.  Most contributions require
  you to agree to a Contributor License Agreement (CLA) declaring that you have
  the right to, and actually do, grant us the rights to use your contribution. For
  details, visit [cla.microsoft.com][cla].

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct].
  For more information, see the [Code of Conduct FAQ][coc_faq]
  or contact [opencode@microsoft.com][coc_contact] with any
  additional questions or comments.

  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Fsdk%2Fsearch%2FAzure.Search.Documents%2FREADME.png)



  * [Microsoft Azure SDK for Python](https://github.com/Azure/azure-sdk-for-python)

  <!-- LINKS -->

  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fsdk%2Fsearch%2Fazure-search-documents%2FREADME.png)

  [azure_cli]: https://docs.microsoft.com/cli/azure
  [azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [azure_sub]: https://azure.microsoft.com/free/
  [search_resource]: https://docs.microsoft.com/azure/search/search-create-service-portal
  [azure_portal]: https://portal.azure.com

  [create_search_service_docs]: https://docs.microsoft.com/azure/search/search-create-service-portal
  [create_search_service_ps]: https://docs.microsoft.com/azure/search/search-manage-powershell#create-or-delete-a-service
  [create_search_service_cli]: https://docs.microsoft.com/cli/azure/search/service?view=azure-cli-latest#az-search-service-create
  [search_contrib]: https://github.com/Azure/azure-sdk-for-python/blob/main/CONTRIBUTING.md
  [python_logging]: https://docs.python.org/3.5/library/logging.html

  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com


pkgId: 8ad577f83604e3fc473c6f7f8dbaac6933ebd5d4facc80fffa49c01a3fb8e423
name: python-azure-search-nspkg
arch: src
version: 1.0.0
epoch: 0
release: 1
summary: Microsoft Azure Search Namespace Package [Internal]
url: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/search
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-search-nspkg-1.0.0-1.src.rpm
checksum_type: sha256
description:
  This is the Microsoft Azure Search namespace package. It isn't intended to
  be installed directly. Search client libraries are located elsewhere:
  - [`azure-search-documents`](https://pypi.org/project/azure-search-documents)

  This package is for Python 2 only. It provides the necessary files for other
  packages to extend the `azure` namespace. Python 3.x libraries use
  [`PEP420`](https://www.python.org/dev/peps/pep-0420/) instead.

  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fsdk%search%2Fazure-search-nspkg%2FFREADME.png)


pkgId: b3b034f3623ecaf82aa55b5ee66bd15436e04a5466671ecdfcf7ca367f2d3e30
name: python-azure-security-attestation
arch: src
version: 1.0.0
epoch: 0
release: 1
summary: Microsoft Azure Attestation Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-security-attestation-1.0.0-1.src.rpm
checksum_type: sha256
description:
  The Microsoft Azure Attestation (MAA) service is a unified solution for remotely verifying the trustworthiness of a platform and integrity of the binaries running inside it. The service supports attestation of the platforms backed by Trusted Platform Modules (TPMs) alongside the ability to attest to the state of Trusted Execution Environments (TEEs) such as Intel(tm) Software Guard Extensions (SGX) enclaves and Virtualization-based Security (VBS) enclaves.

  Attestation is a process for demonstrating that software binaries were properly instantiated on a trusted platform. Remote relying parties can then gain confidence that only such intended software is running on trusted hardware. Azure Attestation is a unified customer-facing service and framework for attestation.

  Azure Attestation enables cutting-edge security paradigms such as Azure Confidential computing and Intelligent Edge protection. Customers have been requesting the ability to independently verify the location of a machine, the posture of a virtual machine (VM) on that machine, and the environment within which enclaves are running on that VM. Azure Attestation will empower these and many additional customer requests.

  Azure Attestation receives evidence from compute entities, turns them into a set of claims, validates them against configurable policies, and produces cryptographic proofs for claims-based applications (for example, relying parties and auditing authorities).

  This package has been tested with Python 2.7, 3.6 to 3.9.

  For a more complete view of Azure libraries, see the [Azure SDK for Python release page](https://aka.ms/azsdk/python/all).

  [Source code][source_code] | [Package (PyPI)][Attestation_pypi] | [API reference documentation][API_reference] | [Product documentation](https://docs.microsoft.com/azure/attestation/)





  * An Azure subscription.  To use Azure services, including the Azure Attestation service, you'll need a subscription.  If you do not have an existing Azure account, you may sign up for a [free trial][azure_sub] or use your [Visual Studio Subscription](https://visualstudio.microsoft.com/subscriptions/) benefits when you [create an account](https://account.windowsazure.com/Home/Index).
  * An existing Azure Attestation Instance, or you can use the "shared provider" available in each Azure region. If you need to create an Azure Attestation service instance, you can use the Azure Portal or [Azure CLI][azure_cli].



  Install the Azure Attestation client library for Python with [PyPI][Attestation_pypi]:

  ```Powershell
  pip install azure-security-attestation
  ```



  In order to interact with the Azure Attestation service, you'll need to create an instance of the [Attestation Client][attestation_client] or [Attestation Administration Client][attestation_admin_client] class. You need an **attestation endpoint**, which you may see as "Attest URI" in the portal,
  and **client credentials (client id, client secret, tenant id)** to instantiate a client object.

  [Client secret credential][ClientSecretCredential] authentication is being used in this getting started section but you can find more ways to authenticate with the [Azure identity package][azure_identity]. To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below,
  or other credential providers provided with the Azure SDK, you should install the azure-identity package:

  ```Powershell
  pip install azure-identity
  ```



  Use the [Azure CLI][azure_cli] snippet below to create/get client secret credentials.

  * Create a service principal and configure its access to Azure resources:

      ```Powershell
      az ad sp create-for-rbac -n <your-application-name> --skip-assignment
      ```

      Output:

      ```json
      {
          "appId": "generated-app-ID",
          "displayName": "dummy-app-name",
          "name": "http://dummy-app-name",
          "password": "random-password",
          "tenant": "tenant-ID"
      }
      ```

  * Take note of the service principal objectId

      ```Powershell
      az ad sp show --id <appId> --query objectId
      ```

      Output:

      ```Powershell
      "<your-service-principal-object-id>"
      ```

  * Use the returned credentials above to set  **AZURE_CLIENT_ID** (appId), **AZURE_CLIENT_SECRET** (password), and **AZURE_TENANT_ID** (tenant) environment variables. The following example shows a way to do this in Powershell:

      ```Powershell
      $Env:AZURE_CLIENT_ID="generated-app-ID"
      $Env:AZURE_CLIENT_SECRET="random-password"
      $Env:AZURE_TENANT_ID="tenant-ID"
      ```

  For more information about the Azure Identity APIs and how to use them, see [Azure Identity client library](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity)



  There are four major families of functionality provided in this preview SDK:

  * [SGX and TPM enclave attestation.](#attestation)
  * [MAA Attestation Token signing certificate discovery and validation.](#attestation-token-signing-certificate-discovery-and-validation)
  * [Attestation Policy management.](#policy-management)
  * [Attestation policy management certificate management](#policy-management-certificate-management) (yes, policy management management).

  The Microsoft Azure Attestation service runs in two separate modes: "Isolated" and "AAD". When the service is running in "Isolated" mode, the customer needs to
  provide additional information beyond their authentication credentials to verify that they are authorized to modify the state of an attestation instance.

  Finally, each region in which the Azure Attestation service is available supports a "shared" instance, which
  can be used to attest SGX enclaves which only need verification against the azure baseline (there are no policies applied to the shared instance). TPM attestation is not available in the shared instance.
  While the shared instance requires AAD authentication, it does not have any RBAC policies - any customer with a valid AAD bearer token can attest using the shared instance.



  SGX or TPM attestation is the process of validating evidence collected from
  a trusted execution environment to ensure that it meets both the Azure baseline for that environment and customer defined policies applied to that environment.



  One of the core operational guarantees of the Azure Attestation Service is that the service operates "operationally out of the TCB". In other words, there is no way that a Microsoft operator could tamper with the operation of the service, or corrupt data sent from the client. To ensure this guarantee, the core of the attestation service runs in an Intel(tm) SGX enclave.

  To allow customers to verify that operations were actually performed inside the enclave, most responses from the Attestation Service are encoded in a [JSON Web Token][json_web_token], which is signed by a key held within the attestation service's enclave.

  This token will be signed by a signing certificate issued by the MAA service for the specified instance.

  If the MAA service instance is running in a region where the service runs in an SGX enclave, then
  the certificate issued by the server can be verified using the [oe_verify_attestation_certificate API](https://openenclave.github.io/openenclave/api/enclave_8h_a3b75c5638360adca181a0d945b45ad86.html).



  Each attestation service instance has a policy applied to it which defines additional criteria which the customer has defined.

  For more information on attestation policies, see [Attestation Policy](https://docs.microsoft.com/azure/attestation/author-sign-policy)



  When an attestation instance is running in "Isolated" mode, the customer who created the instance will have provided
  a policy management certificate at the time the instance is created. All policy modification operations require that the customer sign
  the policy data with one of the existing policy management certificates. The Policy Management Certificate Management APIs enable
  clients to "roll" the policy management certificates.



  Each Microsoft Azure Attestation service instance operates in either "AAD" mode or "Isolated" mode. When an MAA instance is operating in AAD mode, it means that the customer which created the attestation instance allows Azure Active Directory and Azure Role Based Access control policies to verify access to the attestation instance.



  The Azure Attestation service supports attesting different types of evidence depending on the environment.
  Currently, MAA supports the following Trusted Execution environments:

  * OpenEnclave - An Intel(tm) Processor running code in an SGX Enclave where the attestation evidence was collected using the OpenEnclave [oe_get_report](https://openenclave.io/apidocs/v0.14/enclave_8h_aefcb89c91a9078d595e255bd7901ac71.html#aefcb89c91a9078d595e255bd7901ac71) or [oe_get_evidence](https://openenclave.io/apidocs/v0.14/attester_8h_a7d197e42468636e95a6ab97b8e74c451.html#a7d197e42468636e95a6ab97b8e74c451) API.
  * SgxEnclave - An Intel(tm) Processor running code in an SGX Enclave where the attestation evidence was collected using the Intel SGX SDK.
  * Tpm - A Virtualization Based Security environment where the Trusted Platform Module of the processor is used to provide the attestation evidence.



  RuntimeData refers to data which is presented to the Intel SGX Quote generation logic or the `oe_get_report`/`oe_get_evidence` APIs. If the caller to the attest API provided a `runtime_data` attribute, The Azure Attestation service will validate that the first 32 bytes of the `report_data` field in the SGX Quote/OE Report/OE Evidence matches the SHA256 hash of the `runtime_data`.

  InitTime data refers to data which is used to configure the SGX enclave being attested.

  > Note that InitTime data is not supported on Azure [DCsv2-Series](https://docs.microsoft.com/azure/virtual-machines/dcv2-series) virtual machines.





  * [Create an attestation client instance](#create-client-instance)
  * [Attest an SGX enclave](#attest-sgx-enclave)
  * [Get attestation policy](#get-attestation-policy)
  * [Retrieve token validation certificates](#retrieve-token-certificates)
  * [Create an attestation client instance](#create-client-instance)



  Creates an instance of the Attestation Client at uri `endpoint`.

  ```python
  attest_client = AttestationClient(
      endpoint=base_uri,
      credential=DefaultAzureCredential())
  ```



  The `set_policy` method retrieves the attestation policy from the service.
  Attestation Policies are instanced on a per-attestation type basis, the `AttestationType` parameter defines the type to retrieve.

  ```python
  policy, token = attest_client.get_policy(AttestationType.SGX_ENCLAVE)
  print('Instance SGX policy: ', policy)
  print('Token: ', token)
  ```



  If the attestation service instance is running in Isolated mode, the set_policy API needs to provide a signing certificate (and private key) which can be used to validate that the caller is authorized to modify policy on the attestation instance. If the service instance is running in AAD mode, then the signing certificate and key are optional.

  Under the covers, the SetPolicy APIs create a [JSON Web Token][json_web_token] based on the policy document and signing information which is sent to the attestation service.

  ```python
  policy_set_response = attest_client.set_policy(AttestationType.SGX_ENCLAVE,
      attestation_policy,
      signing_key=key,
      signing_certificate=signing_certificate)
  new_policy, _ = attest_client.get_policy(AttestationType.SGX_ENCLAVE)

  ```

  If the service instance is running in AAD mode, the call to set_policy can be
  simplified:

  ```python
  policy_set_response = attest_client.set_policy(AttestationType.SGX_ENCLAVE,
      attestation_policy)

  new_policy, _ = attest_client.get_policy(AttestationType.SGX_ENCLAVE)

  ```

  Clients need to be able to verify that the attestation policy document was not modified before the policy document was received by the attestation service's enclave.

  There are two properties provided in the [PolicyResult][attestation_policy_result] that can be used to verify that the service received the policy document:

  * [policy_signer][attestation_policy_result_parameters] - if the `set_policy` call included a signing certificate, this will be the certificate provided at the time of the `set_policy` call. If no policy signer was set, this will be null.
  * [policy_token_hash][attestation_policy_result_parameters] - this is the hash of the [JSON Web Token][json_web_token] sent to the service.

  To verify the hash, clients can generate an attestation policy token and verify the hash generated from that token:

  ```python
  from cryptography.hazmat.primitives import hashes

  expected_policy = AttestationPolicyToken(
      attestation_policy,
      signing_key=key,
      signing_certificate=signing_certificate)
  hasher = hashes.Hash(hashes.SHA256())
  hasher.update(expected_policy.serialize().encode('utf-8'))
  expected_hash = hasher.finalize()


  ```



  Use the [attest_sgx_enclave][attest_sgx] method to attest an SGX enclave.

  One of the core challenges customers have interacting with encrypted environments is how to ensure that you can securely communicate with the code running in the environment ("enclave code").

  One solution to this problem is what is known as "Secure Key Release", which is a pattern that enables secure communication with enclave code.

  To implement the "Secure Key Release" pattern, the enclave code generates an ephemeral asymmetric key. It then serializes the public portion of the key to some format (possibly a JSON Web Key, or PEM, or some other serialization format).

  The enclave code then calculates the SHA256 value of the public key and passes it as an input to code which generates an SGX Quote (for OpenEnclave, that would be the [oe_get_evidence](https://openenclave.io/apidocs/v0.14/attester_8h_a7d197e42468636e95a6ab97b8e74c451.html#a7d197e42468636e95a6ab97b8e74c451) or  [oe_get_report](https://openenclave.io/apidocs/v0.14/enclave_8h_aefcb89c91a9078d595e255bd7901ac71.html#aefcb89c91a9078d595e255bd7901ac71)).

  The client then sends the SGX quote and the serialized key to the attestation service. The attestation service will validate the quote and ensure that the hash of the key is present in the quote and will issue an "Attestation Token".

  The client can then send that Attestation Token (which contains the serialized key) to a 3rd party "relying party". The relying party then validates that the attestation token was created by the attestation service, and thus the serialized key can be used to encrypt some data held by the "relying party" to send to the service.

  This example shows one common pattern of calling into the attestation service to retrieve an attestation token associated with a request.

  This example assumes that you have an existing `AttestationClient` object which is configured with the base URI for your endpoint. It also assumes that you have an SGX Quote (`quote`) generated from within the SGX enclave you are attesting, and "Runtime Data" (`runtime_data`) which is referenced in the SGX Quote.

  ```python
  response, token = attest_client.attest_sgx_enclave(quote, runtime_data=runtime_data)
  ```

  At this point, the enclave_held_data attribute in the attestationResult
  will hold the input binary runtime_data.

  The token is now passed to the "relying party". The relying party will
  validate that the token was issued by the Attestation Service. It then
  extracts the asymmetric key from the EnclaveHeldData field. The relying
  party will then Encrypt its "key" data using the asymmetric key and
  transmits it back to the enclave.

  ```python
  encrypted_data = send_token_to_relying_party(attestationResult.Token)
  ```

  Now the encrypted data can be passed into the enclave which can decrypt that data.

  Additional information on how to perform attestation token validation can be found in the [MAA Service Attestation Sample](https://github.com/Azure-Samples/microsoft-azure-attestation).



  Use `get_signing_certificates` to retrieve the certificates which can be used to validate the token returned from the attestation service.

  ```python
  signers = attest_client.get_signing_certificates()
  for signer in signers:
      from cryptography.hazmat.backends import default_backend
      cert = cryptography.x509.load_pem_x509_certificate(signer.certificates[0].encode('ascii'), backend=default_backend())
      print('Cert  iss:', cert.issuer, '; subject:', cert.subject)
  ```



  Most Attestation service operations will raise exceptions defined in [Azure Core](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md). The attestation service APIs will throw a `HttpResponseError` on failure with helpful error codes. Many of these errors are recoverable.

  ```python
  try:
      response, _ = attest_client.attest_sgx_enclave(
          quote,
          runtime_data=AttestationData(runtime_data, is_json=False))
  except HttpResponseError as ex:
      
      if ex.error == "InvalidParameter":
          pass
  }
  ```

  Additional troubleshooting information for the MAA service can be found [here](https://docs.microsoft.com/python/api/overview/azure/attestation?view=azure-python-preview)



  For more information about the Microsoft Azure Attestation service, please see our [documentation page](https://docs.microsoft.com/azure/attestation/).



  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [the Contributor License Agreement site](https://cla.microsoft.com).

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][microsoft_code_of_conduct]. For more information see the Code of Conduct FAQ or contact <opencode@microsoft.com> with any additional questions or comments.

  See [CONTRIBUTING.md][contributing] for details on building, testing, and contributing to these libraries.



  If you encounter any bugs or have suggestions, please file an issue in the
  [Issues](https://github.com/Azure/azure-sdk-for-python/issues)
  section of the project.

  <!-- LINKS -->
  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/attestation/azure-security-attestation
  [azure_identity]: https://docs.microsoft.com/python/api/overview/azure/identity-readme?view=azure-python-preview
  [DefaultAzureCredential]: https://docs.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python
  [ClientSecretCredential]: https://docs.microsoft.com/python/api/azure-identity/azure.identity.clientsecretcredential?view=azure-python
  [attestation_policy_result]:https://docs.microsoft.com/python/api/azure-security-attestation/azure.security.attestation.policyresult?view=azure-python-preview
  [attestation_client]: https://docs.microsoft.com/python/api/azure-security-attestation/azure.security.attestation.attestationclient?view=azure-python-preview
  [attestation_admin_client]: https://docs.microsoft.com/python/api/azure-security-attestation/azure.security.attestation.attestationadministrationclient?view=azure-python-preview
  [attestation_policy_result_parameters]: https://docs.microsoft.com/python/api/azure-security-attestation/azure.security.attestation.policyresult?view=azure-python-preview#parameters
  [attest_sgx]: https://docs.microsoft.com/python/api/azure-security-attestation/azure.security.attestation.attestationclient?view=azure-python-preview#attest-sgx-enclave-quote--inittime-data-none--runtime-data-none--draft-policy-none----kwargs-
  [attestation_pypi]: https://aka.ms/azsdk/python/azure-security-attestation
  [API_reference]:https://docs.microsoft.com/python/api/overview/azure/security-attestation-readme?view=azure-python-preview
  [style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization
  [style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide
  [microsoft_code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [azure_cli]: https://docs.microsoft.com/cli/azure
  [azure_sub]: https://azure.microsoft.com/free/
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [json_web_token]: https://tools.ietf.org/html/rfc7519
  [JWK]: https://tools.ietf.org/html/rfc7517
  [base64url_encoding]: https://tools.ietf.org/html/rfc4648#section-5
  [contributing]: https://github.com/Azure/azure-sdk-for-python/blob/main/CONTRIBUTING.md
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/

  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fsdk%2Fattestation%2Fazure-security-attestation%2FREADME.png)








  Sample cleanup - instead of using `ClientSecretCredentials`, the samples now use
  DefaultAzureCredential.



  * TPM attestation takes a JSON string parameter and returns a JSON string parameter.
    * `TPMAttestationRequest` and `TPMAttestationResponse` type were removed.
  * `confirmation` attribute removed from `AttestationResult` type.
  * The `AttestationSigningKey` type was removed, replaced with a `signing_key` and
   `signing_certificate` kwargs parameter.
  * All certificates and keys accepted and returned by the SDK are now PEM encoded
    strings instead of DER encoded arrays of bytes for easier manipulation and
    interoperability.
  * Removed `AttestationResponse` type, token value merged into `AttestationResult`,
    `PolicyResult`, etc.
  * Removed `TokenValidationOptions` type and merged the validation options into
    keyword arguments on the APIs which validate returned tokens. Those keyword
    arguments can also be specified on the Client classes to simplify individual
    API invocations.
  * Renamed `instance_url` parameter to the constructors to `endpoint`.
  * Many optional fields in `AttestationResult` were made non-optional.
  * `AttestationToken._validate_token` is made internal-only, and now returns `None`.
    * The caller provided `validation_callback` now must throw exceptions on invalid
    tokens rather than returning `False`.
  * Removed the `AttestationData` type, instead the `attest_xxx` APIs take two sets
    of parameters: `inittime_data` and `inittime_json` and `runtime_data` and `runtime_json`.
    if the `_json` value is set, the value of the parameter is an array of UTF8 encoded
    JSON values, if the `_data` value is set, the value of the parameter is an array
    of bytes.
  * The `get_policy` API now returns a `Tuple[str, AttestationToken]` to simplify
    the consumption experience.
  * The `get_policy_management_certificates` API also returns a `Tuple[list[list[string]], AttestationToken]` to simplify the consumption experience. Note that each of the entries
  in the list is a PEM encoded X.509 certificate.

  To call into the attest APIs if you care about the attestation policy and token,
  you can write:

  ```python
  policy, token = attest_client.get_policy(AttestationType.SGX_ENCLAVE)
  ```

  If you only care about the policy, you can write any of the following:

  ```python
  policy, _ = attest_client.get_policy(AttestationType.SGX_ENCLAVE)
  ```

  or

  ```python
  policy = attest_client.get_policy(AttestationType.SGX_ENCLAVE)[0]
  ```

  or

  ```python
  response = attest_client.get_policy(AttestationType.SGX_ENCLAVE)
  policy = response[0]
  ```

  * The `AttestationToken` class no longer inherits from `Generic`.
  * The `attest_sgx_enclave`, and `attest_openenclave` APIs now return a tuple of
    `AttestationResult`, `AttestationToken`, similar to the `get_policy` API.
  * The `set_policy`, `reset_policy`, `add_policy_management_certificate`, and `remove_policy_management_certificate` APIs all return a tuple.
  * The `AttestationToken.get_body()` API was renamed `AttestationToken.body()`
  * Several time related properties were renamed to be consistent with the usage from
    keyvault:
    * The `expiration_time` property on `AttestationToken` was renamed to `expires`.
    * The `issuance_time` property on `AttestationToken` was renamed to `issued_on`.
    * The `not_before_time` property on `AttestationToken` was renamed to `not_before`.
  * The `StoredAttestationPolicy` model type has been removed. To validate the attestation policy hash, use the `AttestationPolicyToken` model object instead.
  * The `get_openidmetadata` API has been renamed `get_open_id_metadata`.





  * Added reset_policy API.
  * Added models.
  * Documentation cleanup.



  * Creating the `StoredAttestationPolicy` model type means that the `attestation_policy`
      kwargs parameter for the constructor has been replaced with a positional `policy` parameter. As a result of this change, this code:

  ```python
  StoredAttestationPolicy(attestation_policy=str(attestation_policy).encode('utf-8')))
  ```

  changes to:

  ```python
  StoredAttestationPolicy(attestation_policy)
  ```

  * Several parameters for the `AttestationResult` type have been renamed, and
      several parameters which were shared with `AttestationToken` have been
      removed. In general, the naming changes removed some protocol specific
      elements and replaced them with friendlier names. Finally, the deprecated
      attributes have been removed from the `AttestationResult`

      Full set of changes:
    * `iss` renamed to `issuer`
    * `cnf` renamed to `confirmation`
    * `jti` renamed to `unique_identifier`
    * `iat` removed
    * `exp` removed
    * `nbf` removed
    * `deprecated_version` removed
    * `deprecated_is_debuggable` removed
    * `deprecated_sgx_collateral` removed
    * `deprecated_enclave_held_data` removed
    * `deprecated_enclave_held_data2` removed
    * `deprecated_product_id` removed
    * `deprecated_mr_enclave` removed
    * `deprecated_mr_signer` removed
    * `deprecated_svn` removed
    * `deprecated_tee` removed
    * `deprecated_policy_signer` removed
    * `deprecated_policy_hash` removed
    * `deprecated_rp_data` removed

    If customers need to access the removed or renamed fields directly, they can
    use the `get_body` method of the `AttestationResponse` object:

    ```python
      if response.token.get_body().deprecated_tee != 'sgx':
          print("Unexpected tee claim in token")
    ```





  * Preliminary implementation of a Track 2 SDK for the attestation service.



  * Complete reimplementation of the API surface, follows the API patterns already
  established for the attestation service.



  Initial early preview release for MAA Data Plane SDK
  Demonstrates use of the machine generated MAA APIs.

  * Initial Release


pkgId: 8d93e89c6c7dee97e2c34228c4318bdf938fb88f87ea6b24bc945d62cd33772a
name: python-azure-servicebus
arch: src
version: 7.12.2
epoch: 0
release: 1
summary: Microsoft Azure Service Bus Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-servicebus-7.12.2-1.src.rpm
checksum_type: sha256
description:
  Azure Service Bus is a high performance cloud-managed messaging service for providing real-time and fault-tolerant communication between distributed senders and receivers.

  Service Bus provides multiple mechanisms for asynchronous highly reliable communication, such as structured first-in-first-out messaging,
  publish/subscribe capabilities, and the ability to easily scale as your needs grow.

  Use the Service Bus client library for Python to communicate between applications and services and implement asynchronous messaging patterns.

  * Create Service Bus namespaces, queues, topics, and subscriptions, and modify their settings.
  * Send and receive messages within your Service Bus channels.
  * Utilize message locks, sessions, and dead letter functionality to implement complex messaging patterns.

  [Source code](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/)
  | [Package (PyPi)][pypi]
  | [Package (Conda)](https://anaconda.org/microsoft/azure-servicebus)
  | [API reference documentation][api_docs]
  | [Product documentation][product_docs]
  | [Samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples)
  | [Changelog](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/CHANGELOG.md)

  **NOTE**: If you are using version 0.50 or lower and want to migrate to the latest version
  of this package please look at our [migration guide to move from Service Bus V0.50 to Service Bus V7][migration_guide].





  Install the Azure Service Bus client library for Python with [pip][pip]:

  ```Bash
  pip install azure-servicebus
  ```


  To use this package, you must have:
  * Azure subscription - [Create a free account][azure_sub]
  * Azure Service Bus - [Namespace and management credentials][service_bus_namespace]
  * Python 3.8 or later - [Install Python][python]


  If you need an Azure service bus namespace, you can create it via the [Azure Portal][azure_namespace_creation].
  If you do not wish to use the graphical portal UI, you can use the Azure CLI via [Cloud Shell][cloud_shell_bash], or Azure CLI run locally, to create one with this Azure CLI command:

  ```Bash
  az servicebus namespace create --resource-group <resource-group-name> --name <servicebus-namespace-name> --location <servicebus-namespace-location>
  ```



  Interaction with Service Bus starts with an instance of the `ServiceBusClient` class. You either need a **connection string with SAS key**, or a **namespace** and one of its **account keys** to instantiate the client object.
  Please find the samples linked below for demonstration as to how to authenticate via either approach.



  - To obtain the required credentials, one can use the [Azure CLI][azure_cli] snippet (Formatted for Bash Shell) at the top of the linked sample to populate an environment variable with the service bus connection string (you can also find these values in the [Azure Portal][azure_portal] by following the step-by-step guide to [Get a service bus connection string][get_servicebus_conn_str]).



  - This constructor takes the fully qualified namespace of your Service Bus instance and a credential that implements the
  [TokenCredential][token_credential_interface]
  protocol. There are implementations of the `TokenCredential` protocol available in the
  [azure-identity package][pypi_azure_identity]. The fully qualified namespace is of the format `<yournamespace.servicebus.windows.net>`.
  - To use the credential types provided by `azure-identity`, please install the package:
  ```pip install azure-identity```
  - Additionally, to use the async API, you must first install an async transport, such as [`aiohttp`](https://pypi.org/project/aiohttp/):
  ```pip install aiohttp```
  - When using Azure Active Directory, your principal must be assigned a role which allows access to Service Bus, such as the
  Azure Service Bus Data Owner role. For more information about using Azure Active Directory authorization with Service Bus,
  please refer to [the associated documentation][servicebus_aad_authentication].

  >**Note:** client can be initialized without a context manager, but must be manually closed via client.close() to not leak resources.



  Once you've initialized a `ServiceBusClient`, you can interact with the primary resource types within a Service Bus Namespace, of which multiple can exist and on which actual message transmission takes place, the namespace often serving as an application container:

  * [Queue][queue_concept]: Allows for Sending and Receiving of message.  Often used for point-to-point communication.

  * [Topic][topic_concept]: As opposed to Queues, Topics are better suited to publish/subscribe scenarios.  A topic can be sent to, but requires a subscription, of which there can be multiple in parallel, to consume from.

  * [Subscription][subscription_concept]: The mechanism to consume from a Topic.  Each subscription is independent, and receives a copy of each message sent to the topic.  Rules and Filters can be used to tailor which messages are received by a specific subscription.

  For more information about these resources, see [What is Azure Service Bus?][service_bus_overview].

  To interact with these resources, one should be familiar with the following SDK concepts:

  * [ServiceBusClient][client_reference]: This is the object a user should first initialize to connect to a Service Bus Namespace.  To interact with a queue, topic, or subscription, one would spawn a sender or receiver off of this client.

  * [ServiceBusSender][sender_reference]: To send messages to a Queue or Topic, one would use the corresponding `get_queue_sender` or `get_topic_sender` method off of a `ServiceBusClient` instance as seen [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples/sync_samples/send_queue.py).

  * [ServiceBusReceiver][receiver_reference]: To receive messages from a Queue or Subscription, one would use the corresponding `get_queue_receiver` or `get_subscription_receiver` method off of a `ServiceBusClient` instance as seen [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples/sync_samples/receive_queue.py).

  * [ServiceBusMessage][message_reference]: When sending, this is the type you will construct to contain your payload.  When receiving, this is where you will access the payload.



  We do not guarantee that the ServiceBusClient, ServiceBusSender, and ServiceBusReceiver are thread-safe. We do not recommend reusing these instances across threads. It is up to the running application to use these classes in a thread-safe manner.



  The following sections provide several code snippets covering some of the most common Service Bus tasks, including:

  * [Send messages to a queue](#send-messages-to-a-queue "Send messages to a queue")
  * [Receive messages from a queue](#receive-messages-from-a-queue "Receive messages from a queue")
  * [Send and receive a message from a session enabled queue](#send-and-receive-a-message-from-a-session-enabled-queue "Send and receive a message from a session enabled queue")
  * [Working with topics and subscriptions](#working-with-topics-and-subscriptions "Working with topics and subscriptions")
  * [Settle a message after receipt](#settle-a-message-after-receipt "Settle a message after receipt")
  * [Automatically renew Message or Session locks](#automatically-renew-message-or-session-locks "Automatically renew Message or Session locks")

  To perform management tasks such as creating and deleting queues/topics/subscriptions, please utilize the azure-mgmt-servicebus library, available [here][servicebus_management_repository].

  Please find further examples in the [samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples) directory demonstrating common Service Bus scenarios such as sending, receiving, session management and message handling.


  > **NOTE:** see reference documentation [here][send_reference].

  This example sends single message and array of messages to a queue that is assumed to already exist, created via the Azure portal or az commands.

  ```python
  from azure.servicebus import ServiceBusClient, ServiceBusMessage

  import os
  connstr = os.environ['SERVICE_BUS_CONNECTION_STR']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']

  with ServiceBusClient.from_connection_string(connstr) as client:
      with client.get_queue_sender(queue_name) as sender:
          
          single_message = ServiceBusMessage("Single message")
          sender.send_messages(single_message)

          
          messages = [ServiceBusMessage("First message"), ServiceBusMessage("Second message")]
          sender.send_messages(messages)
  ```

  > **NOTE:** A message may be scheduled for delayed delivery using the `ServiceBusSender.schedule_messages()` method, or by specifying `ServiceBusMessage.scheduled_enqueue_time_utc` before calling `ServiceBusSender.send_messages()`

  > For more detail on scheduling and schedule cancellation please see a sample [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples/sync_samples/schedule_messages_and_cancellation.py).



  To receive from a queue, you can either perform an ad-hoc receive via `receiver.receive_messages()` or receive persistently through the receiver itself.



  ```python
  from azure.servicebus import ServiceBusClient

  import os
  connstr = os.environ['SERVICE_BUS_CONNECTION_STR']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']

  with ServiceBusClient.from_connection_string(connstr) as client:
      
      
      with client.get_queue_receiver(queue_name, max_wait_time=30) as receiver:
          for msg in receiver:  # ServiceBusReceiver instance is a generator.
              print(str(msg))
              
  ```

  > **NOTE:** Any message received with `receive_mode=PEEK_LOCK` (this is the default, with the alternative RECEIVE_AND_DELETE removing the message from the queue immediately on receipt)
  > has a lock that must be renewed via `receiver.renew_message_lock` before it expires if processing would take longer than the lock duration.
  > See [AutoLockRenewer](#automatically-renew-message-or-session-locks "Automatically renew Message or Session locks") for a helper to perform this in the background automatically.
  > Lock duration is set in Azure on the queue or topic itself.



  > **NOTE:** `ServiceBusReceiver.receive_messages()` receives a single or constrained list of messages through an ad-hoc method call, as opposed to receiving perpetually from the generator. It always returns a list.

  ```python
  from azure.servicebus import ServiceBusClient

  import os
  connstr = os.environ['SERVICE_BUS_CONNECTION_STR']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']

  with ServiceBusClient.from_connection_string(connstr) as client:
      with client.get_queue_receiver(queue_name) as receiver:
          received_message_array = receiver.receive_messages(max_wait_time=10)  # try to receive a single message within 10 seconds
          if received_message_array:
              print(str(received_message_array[0]))

      with client.get_queue_receiver(queue_name) as receiver:
          received_message_array = receiver.receive_messages(max_message_count=5, max_wait_time=10)  # try to receive maximum 5 messages in a batch within 10 seconds
          for message in received_message_array:
              print(str(message))
  ```

  In this example, max_message_count declares the maximum number of messages to attempt receiving before hitting a max_wait_time as specified in seconds.

  > **NOTE:** It should also be noted that `ServiceBusReceiver.peek_messages()` is subtly different than receiving, as it does not lock the messages being peeked, and thus they cannot be settled.



  > **NOTE:** see reference documentation for session [send][session_send_reference] and [receive][session_receive_reference].

  Sessions provide first-in-first-out and single-receiver semantics on top of a queue or subscription.  While the actual receive syntax is the same, initialization differs slightly.

  ```python
  from azure.servicebus import ServiceBusClient, ServiceBusMessage

  import os
  connstr = os.environ['SERVICE_BUS_CONNECTION_STR']
  queue_name = os.environ['SERVICE_BUS_SESSION_QUEUE_NAME']
  session_id = os.environ['SERVICE_BUS_SESSION_ID']

  with ServiceBusClient.from_connection_string(connstr) as client:
      with client.get_queue_sender(queue_name) as sender:
          sender.send_messages(ServiceBusMessage("Session Enabled Message", session_id=session_id))

      
      with client.get_queue_receiver(queue_name, session_id=session_id) as receiver:
          for msg in receiver:
              print(str(msg))
  ```

  > **NOTE**: Messages received from a session do not need their locks renewed like a non-session receiver; instead the lock management occurs at the
  > session level with a session lock that may be renewed with `receiver.session.renew_lock()`



  > **NOTE:** see reference documentation for [topics][topic_reference] and [subscriptions][subscription_reference].

  Topics and subscriptions give an alternative to queues for sending and receiving messages.  See documents [here][topic_concept] for more overarching detail,
  and of how these differ from queues.

  ```python
  from azure.servicebus import ServiceBusClient, ServiceBusMessage

  import os
  connstr = os.environ['SERVICE_BUS_CONNECTION_STR']
  topic_name = os.environ['SERVICE_BUS_TOPIC_NAME']
  subscription_name = os.environ['SERVICE_BUS_SUBSCRIPTION_NAME']

  with ServiceBusClient.from_connection_string(connstr) as client:
      with client.get_topic_sender(topic_name) as sender:
          sender.send_messages(ServiceBusMessage("Data"))

      
      with client.get_subscription_receiver(topic_name, subscription_name) as receiver:
          for msg in receiver:
              print(str(msg))
  ```



  When receiving from a queue, you have multiple actions you can take on the messages you receive.

  > **NOTE**: You can only settle `ServiceBusReceivedMessage` objects which are received in `ServiceBusReceiveMode.PEEK_LOCK` mode (this is the default).
  > `ServiceBusReceiveMode.RECEIVE_AND_DELETE` mode removes the message from the queue on receipt.  `ServiceBusReceivedMessage` messages
  > returned from `peek_messages()` cannot be settled, as the message lock is not taken like it is in the aforementioned receive methods.

  If the message has a lock as mentioned above, settlement will fail if the message lock has expired.
  If processing would take longer than the lock duration, it must be maintained via `receiver.renew_message_lock` before it expires.
  Lock duration is set in Azure on the queue or topic itself.
  See [AutoLockRenewer](#automatically-renew-message-or-session-locks "Automatically renew Message or Session locks") for a helper to perform this in the background automatically.



  Declares the message processing to be successfully completed, removing the message from the queue.

  ```python
  from azure.servicebus import ServiceBusClient

  import os
  connstr = os.environ['SERVICE_BUS_CONNECTION_STR']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']

  with ServiceBusClient.from_connection_string(connstr) as client:
      with client.get_queue_receiver(queue_name) as receiver:
          for msg in receiver:
              print(str(msg))
              receiver.complete_message(msg)
  ```



  Abandon processing of the message for the time being, returning the message immediately back to the queue to be picked up by another (or the same) receiver.

  ```python
  from azure.servicebus import ServiceBusClient

  import os
  connstr = os.environ['SERVICE_BUS_CONNECTION_STR']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']

  with ServiceBusClient.from_connection_string(connstr) as client:
      with client.get_queue_receiver(queue_name) as receiver:
          for msg in receiver:
              print(str(msg))
              receiver.abandon_message(msg)
  ```



  Transfer the message from the primary queue into a special "dead-letter sub-queue" where it can be accessed using the `ServiceBusClient.get_<queue|subscription>_receiver` function with parameter `sub_queue=ServiceBusSubQueue.DEAD_LETTER` and consumed from like any other receiver. (see sample [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples/sync_samples/receive_deadlettered_messages.py))

  ```python
  from azure.servicebus import ServiceBusClient

  import os
  connstr = os.environ['SERVICE_BUS_CONNECTION_STR']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']

  with ServiceBusClient.from_connection_string(connstr) as client:
      with client.get_queue_receiver(queue_name) as receiver:
          for msg in receiver:
              print(str(msg))
              receiver.dead_letter_message(msg)
  ```



  Defer is subtly different from the prior settlement methods.  It prevents the message from being directly received from the queue
  by setting it aside such that it must be received by sequence number in a call to `ServiceBusReceiver.receive_deferred_messages` (see sample [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples/sync_samples/receive_deferred_message_queue.py))

  ```python
  from azure.servicebus import ServiceBusClient

  import os
  connstr = os.environ['SERVICE_BUS_CONNECTION_STR']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']

  with ServiceBusClient.from_connection_string(connstr) as client:
      with client.get_queue_receiver(queue_name) as receiver:
          for msg in receiver:
              print(str(msg))
              receiver.defer_message(msg)
  ```


  > **NOTE:** see reference documentation for [auto-lock-renewal][autolockrenew_reference].

  `AutoLockRenewer` is a simple method for ensuring your message or session remains locked even over long periods of time, if calling `receiver.renew_message_lock`/`receiver.session.renew_lock` is impractical or undesired.
  Internally, it is not much more than shorthand for creating a concurrent watchdog to do lock renewal if the object is nearing expiry.
  It should be used as follows:

  * Message lock automatic renewing

  ```python
  from azure.servicebus import ServiceBusClient, AutoLockRenewer

  import os
  connstr = os.environ['SERVICE_BUS_CONNECTION_STR']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']


  renewer = AutoLockRenewer()
  with ServiceBusClient.from_connection_string(connstr) as client:
      with client.get_queue_receiver(queue_name) as receiver:
          for msg in receiver.receive_messages():
              renewer.register(receiver, msg, max_lock_renewal_duration=60)
              
              receiver.complete_message(msg)
  renewer.close()
  ```

  * Session lock automatic renewing

  ```python
  from azure.servicebus import ServiceBusClient, AutoLockRenewer

  import os
  connstr = os.environ['SERVICE_BUS_CONNECTION_STR']
  session_queue_name = os.environ['SERVICE_BUS_SESSION_QUEUE_NAME']
  session_id = os.environ['SERVICE_BUS_SESSION_ID']


  renewer = AutoLockRenewer()
  with ServiceBusClient.from_connection_string(connstr) as client:
      with client.get_queue_receiver(session_queue_name, session_id=session_id) as receiver:
          renewer.register(receiver, receiver.session, max_lock_renewal_duration=300) # Duration for how long to maintain the lock for, in seconds.

          for msg in receiver.receive_messages():
              
              receiver.complete_message(msg)
  renewer.close()
  ```

  If for any reason auto-renewal has been interrupted or failed, this can be observed via the `auto_renew_error` property on the object being renewed, or by having passed a callback to the `on_lock_renew_failure` parameter on renewer initialization.
  It would also manifest when trying to take action (such as completing a message) on the specified object.





  - Enable `azure.servicebus` logger to collect traces from the library.
  - Enable AMQP frame level trace by setting `logging_enable=True` when creating the client.

  ```python
  import logging
  import sys

  handler = logging.StreamHandler(stream=sys.stdout)
  logger = logging.getLogger('azure.servicebus')
  logger.setLevel(logging.DEBUG)
  logger.addHandler(handler)

  ...

  from azure.servicebus import ServiceBusClient

  client = ServiceBusClient(..., logging_enable=True)
  ```



  There are various timeouts a user should be aware of within the library.
  - 10 minute service side link closure:  A link, once opened, will be closed after 10 minutes idle to protect the service against resource leakage.  This should largely
  be transparent to a user, but if you notice a reconnect occurring after such a duration, this is why.  Performing any operations, including management operations, on the
  link will extend this timeout.
  - max_wait_time: Provided on creation of a receiver or when calling `receive_messages()`, the time after which receiving messages will halt after no traffic.  This applies both to the imperative `receive_messages()` function as well as the length
  a generator-style receive will run for before exiting if there are no messages.  Passing None (default) will wait forever, up until the 10 minute threshold if no other action is taken.

  > **NOTE:** If processing of a message or session is sufficiently long as to cause timeouts, as an alternative to calling `receiver.renew_message_lock`/`receiver.session.renew_lock` manually, one can
  > leverage the `AutoLockRenewer` functionality detailed [above](#automatically-renew-message-or-session-locks "Automatically renew Message or Session locks").



  The Service Bus APIs generate the following exceptions in azure.servicebus.exceptions:

  - **ServiceBusConnectionError:** An error occurred in the connection to the service.
  This may have been caused by a transient network issue or service problem. It is recommended to retry.
  - **ServiceBusAuthorizationError:** An error occurred when authorizing the connection to the service.
  This may have been caused by the credentials not having the right permission to perform the operation.
  It is recommended to check the permission of the credentials.
  - **ServiceBusAuthenticationError:** An error occurred when authenticate the connection to the service.
  This may have been caused by the credentials being incorrect. It is recommended to check the credentials.
  - **OperationTimeoutError:** This indicates that the service did not respond to an operation within the expected amount of time.
  This may have been caused by a transient network issue or service problem. The service may or may not have successfully completed the request; the status is not known.
  It is recommended to attempt to verify the current state and retry if necessary.
  - **MessageSizeExceededError:** This indicate that the message content is larger than the service bus frame size.
  This could happen when too many service bus messages are sent in a batch or the content passed into
  the body of a `Message` is too large. It is recommended to reduce the count of messages being sent in a batch or the size of content being passed into a single `ServiceBusMessage`.
  - **MessageAlreadySettled:** This indicates failure to settle the message.
  This could happen when trying to settle an already-settled message.
  - **MessageLockLostError:** The lock on the message has expired and it has been released back to the queue.
  It will need to be received again in order to settle it.
  You should be aware of the lock duration of a message and keep renewing the lock before expiration in case of long processing time.
  `AutoLockRenewer` could help on keeping the lock of the message automatically renewed.
  - **SessionLockLostError:** The lock on the session has expired.
  All unsettled messages that have been received can no longer be settled.
  It is recommended to reconnect to the session if receive messages again if necessary.
  You should be aware of the lock duration of a session and keep renewing the lock before expiration in case of long processing time.
  `AutoLockRenewer` could help on keeping the lock of the session automatically renewed.
  - **MessageNotFoundError:** Attempt to receive a message with a particular sequence number. This message isn't found.
  Make sure the message hasn't been received already. Check the deadletter queue to see if the message has been deadlettered.
  - **MessagingEntityNotFoundError:** Entity associated with the operation doesn't exist or it has been deleted.
  Please make sure the entity exists.
  - **MessagingEntityDisabledError:** Request for a runtime operation on a disabled entity. Please Activate the entity.
  - **ServiceBusQuotaExceededError:** The messaging entity has reached its maximum allowable size, or the maximum number of connections to a namespace has been exceeded.
  Create space in the entity by receiving messages from the entity or its subqueues.
  - **ServiceBusServerBusyError:** Service isn't able to process the request at this time. Client can wait for a period of time, then retry the operation.
  - **ServiceBusCommunicationError:** Client isn't able to establish a connection to Service Bus.
  Make sure the supplied host name is correct and the host is reachable.
  If your code runs in an environment with a firewall/proxy, ensure that the traffic to the Service Bus domain/IP address and ports isn't blocked.
  - **SessionCannotBeLockedError:** Attempt to connect to a session with a specific session ID, but the session is currently locked by another client.
  Make sure the session is unlocked by other clients.
  - **AutoLockRenewFailed:** An attempt to renew a lock on a message or session in the background has failed.
  This could happen when the receiver used by `AutoLockRenewer` is closed or the lock of the renewable has expired.
  It is recommended to re-register the renewable message or session by receiving the message or connect to the sessionful entity again.
  - **AutoLockRenewTimeout:** The time allocated to renew the message or session lock has elapsed. You could re-register the object that wants be auto lock renewed or extend the timeout in advance.
  - **ServiceBusError:** All other Service Bus related errors. It is the root error class of all the errors described above.

  Please view the [exceptions reference docs][exception_reference] for detailed descriptions of our common Exception types.





  Please find further examples in the [samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples) directory demonstrating common Service Bus scenarios such as sending, receiving, session management and message handling.



  For more extensive documentation on the Service Bus service, see the [Service Bus documentation][service_bus_docs] on docs.microsoft.com.



  For users seeking to perform management operations against ServiceBus (Creating a queue/topic/etc, altering filter rules, enumerating entities)
  please see the [azure-mgmt-servicebus documentation][service_bus_mgmt_docs] for API documentation.  Terse usage examples can be found
  [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-mgmt-servicebus/tests) as well.



  The Azure Service Bus client library is now based on a pure Python AMQP implementation. `uAMQP` has been removed as required dependency.

  To use `uAMQP` as the underlying transport:

  1. Install `uamqp` with pip.

  ```
  $ pip install uamqp
  ```

  2. Pass `uamqp_transport=True` during client construction.

  ```python
  from azure.servicebus import ServiceBusClient
  connection_str = '<< CONNECTION STRING FOR THE SERVICE BUS NAMESPACE >>'
  queue_name = '<< NAME OF THE QUEUE >>'
  client = ServiceBusClient.from_connection_string(
      connection_str, uamqp_transport=True
  )
  ```

  Note: The `message` attribute on `ServiceBusMessage`/`ServiceBusMessageBatch`/`ServiceBusReceivedMessage`, which previously exposed the `uamqp.Message`, has been deprecated.
   The "Legacy" objects returned by `message` attribute have been introduced to help facilitate the transition.

  To enable the `uamqp` logger to collect traces from the underlying uAMQP library:
  ```python
  import logging

  uamqp_logger = logging.getLogger('uamqp')
  uamqp_logger.setLevel(logging.DEBUG)
  uamqp_logger.addHandler(handler)

  ...

  from azure.servicebus import ServiceBusClient

  client = ServiceBusClient(..., logging_enable=True)
  ```

  There may be cases where you consider the `uamqp` logging to be too verbose. To suppress unnecessary logging, add the following snippet to the top of your code:
  ```python
  import logging


  uamqp_logger = logging.getLogger('uamqp')
  uamqp_logger.setLevel(logging.ERROR)


  uamqp_connection_logger = logging.getLogger('uamqp.connection')
  uamqp_connection_logger.setLevel(logging.ERROR)
  ```



  `azure-servicebus` depends on the [uAMQP](https://pypi.org/project/uamqp/) for the AMQP protocol implementation.
  uAMQP wheels are provided for most major operating systems and will be installed automatically when installing `azure-servicebus`.
  If [uAMQP](https://pypi.org/project/uamqp/) is intended to be used as the underlying AMQP protocol implementation for `azure-servicebus`,
  uAMQP wheels can be found for most major operating systems.

  If you're running on a platform for which uAMQP wheels are not provided, please follow
  If you intend to use `uAMQP` and you're running on a platform for which uAMQP wheels are not provided, please follow
   the [uAMQP Installation](https://github.com/Azure/azure-uamqp-python#installation) guidance to install from source.



  This project welcomes contributions and suggestions.  Most contributions require you to agree to a
  Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
  the rights to use your contribution. For details, visit https://cla.microsoft.com.

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
  a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
  provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
  For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
  contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

  <!-- LINKS -->
  [azure_cli]: https://docs.microsoft.com/cli/azure
  [api_docs]: https://docs.microsoft.com/python/api/overview/azure/servicebus-readme
  [product_docs]: https://docs.microsoft.com/azure/service-bus-messaging/
  [azure_portal]: https://portal.azure.com
  [azure_sub]: https://azure.microsoft.com/free/
  [cloud_shell]: https://docs.microsoft.com/azure/cloud-shell/overview
  [cloud_shell_bash]: https://shell.azure.com/bash
  [pip]: https://pypi.org/project/pip/
  [pypi]: https://pypi.org/project/azure-servicebus/
  [python]: https://www.python.org/downloads/
  [venv]: https://docs.python.org/3/library/venv.html
  [virtualenv]: https://virtualenv.pypa.io
  [service_bus_namespace]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-create-namespace-portal
  [service_bus_overview]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-messaging-overview
  [queue_status_codes]: https://docs.microsoft.com/rest/api/servicebus/create-queue#response-codes
  [service_bus_docs]: https://docs.microsoft.com/azure/service-bus/
  [service_bus_mgmt_docs]: https://docs.microsoft.com/python/api/azure-mgmt-servicebus/?view=azure-python
  [queue_concept]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-messaging-overview#queues
  [topic_concept]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-messaging-overview#topics
  [subscription_concept]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-queues-topics-subscriptions#topics-and-subscriptions
  [azure_namespace_creation]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-create-namespace-portal
  [servicebus_management_repository]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-mgmt-servicebus
  [get_servicebus_conn_str]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-create-namespace-portal#get-the-connection-string
  [servicebus_aad_authentication]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-authentication-and-authorization
  [token_credential_interface]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core/azure/core/credentials.py
  [pypi_azure_identity]: https://pypi.org/project/azure-identity/
  [message_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html#azure.servicebus.ServiceBusMessage
  [receiver_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html#azure.servicebus.ServiceBusReceiver
  [sender_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html#azure.servicebus.ServiceBusSender
  [client_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html#azure.servicebus.ServiceBusClient
  [send_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=send_messages#azure.servicebus.ServiceBusSender.send_messages
  [receive_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=receive_messages#azure.servicebus.ServiceBusReceiver.receive_messages
  [streaming_receive_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=next#azure.servicebus.ServiceBusReceiver.next
  [session_receive_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=session_id#azure.servicebus.ServiceBusSessionReceiver.receive_messages
  [session_send_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=session_id#azure.servicebus.ServiceBusMessage.session_id
  [complete_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=complete_message#azure.servicebus.ServiceBusReceiver.complete_message
  [abandon_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=abandon_message#azure.servicebus.ServiceBusReceiver.abandon_message
  [defer_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=defer_message#azure.servicebus.ServiceBusReceiver.defer_message
  [deadletter_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=dead_letter_message#azure.servicebus.ServiceBusReceiver.dead_letter_message
  [autolockrenew_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html#azure.servicebus.AutoLockRenewer
  [exception_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html#module-azure.servicebus.exceptions
  [subscription_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.aio.html?highlight=subscription#azure.servicebus.aio.ServiceBusClient.get_subscription_receiver
  [topic_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=topic#azure.servicebus.ServiceBusClient.get_topic_sender
  [sample_authenticate_client_connstr]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/servicebus/azure-servicebus/samples/sync_samples/authenticate_client_connstr.py
  [sample_authenticate_client_aad]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/servicebus/azure-servicebus/samples/sync_samples/client_identity_authentication.py
  [migration_guide]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/migration_guide.md








  - Fixed a bug where WebsocketConnectionClosedException was not being caught when receiving with AmqpOverWebsocket ([34859](https://github.com/Azure/azure-sdk-for-python/pull/34859))
  - Fixed incorrect dependency on typing-extensions ([34869](https://github.com/Azure/azure-sdk-for-python/issues/34869), thanks @YaroBear).





  - Fixed a bug where the client was not retrying when a connection drop happened ([34786](https://github.com/Azure/azure-sdk-for-python/pull/34786))
  - Fixed a bug where the client would not handle a role instance swap on the service correctly ([34820](https://github.com/Azure/azure-sdk-for-python/pull/34820))



  - Updated the logging to more accurately represent when frames are being sent to prevent a client-side idle timeout ([#34793](https://github.com/Azure/azure-sdk-for-python/pull/34793)).





  - Updated `max_wait_time` on the ServiceBusReceiver constructor allowing users to change the default server timeout of 65 seconds when accepting a session on a Session-Enabled/Queues/Topics if NEXT_AVAILABLE_SESSION is used.



  - Updated minimum `azure-core` version to 1.28.0.
  - Updated Pure Python AMQP network trace logging to replace `None` values in AMQP connection info with empty strings as per the OpenTelemetry specification ([#32190](https://github.com/Azure/azure-sdk-for-python/issues/32190)).
  - Updated Pure Python AMQP network trace logging error log on connection close to warning (PR #34504, thanks @RichardOberdieck).





  - Fixed a bug where a two character count session id was being incorrectly parsed by azure amqp.





  - Fixed a bug where `prefetch_count` was not being passed through correctly and caused messages to not be received as expected when in `RECEIVE_AND_DELETE` mode ([#31712](https://github.com/Azure/azure-sdk-for-python/issues/31712), [#31711](https://github.com/Azure/azure-sdk-for-python/issues/31711)).





  - Fixed the error `NoneType object has no attribute 'settle_messages'` which was raised when a connection was dropped due to a blocked process ([#30514](https://github.com/Azure/azure-sdk-for-python/issues/30514))



  - The `__contains__` method was added to `azure.servicebus` for the following (PR #30846, thanks @pamelafox).
    - `ServiceBusConnectionStringProperties`
    - `amqp.AmqpMessageHeader`
    - `amqp.AmqpMessageProperties`
    - `management.AccessRights`
    - `management.NamespaceProperties`
    - `management.QueueProperties`
    - `management.TopicProperties`
    - `management.SubscriptionProperties`
    - `management.RuleProperties`





  - Fixed the error `end frame received on invalid channel` which was raised when a disconnect was sent by the service ([#30860](https://github.com/Azure/azure-sdk-for-python/pull/30860))
  - Fixed the error `link already closed` which was raised when the client was closing and disconnecting from the service ([#30836](https://github.com/Azure/azure-sdk-for-python/pull/30836))



  - The error raised when attempting to complete a message with an expired lock received from a non-sessionful entity has been updated to the more fine-grained `MessageLockLostError` from the superclass `ServiceBusError`.





  - A new float keyword argument `socket_timeout` has been added to `get_queue_sender`, `get_queue_receiver`, `get_topic_sender`, and `get_subscription_receiver` on the sync and async `ServiceBusClient`.



  - Fixed a bug where sending large messages failed on socket write timeout ([#30425](https://github.com/Azure/azure-sdk-for-python/issues/30425)).
  - Fixed a bug where settling large messages failed due to  `delivery_id` being `None`.



  - Tracing updates:
    - Span links on receive/send spans now fall back to using `Diagnostic-Id` if the `traceparent` message application property is not found.
    - Span links will now still be created for receive/send spans even if no context propagation headers are found in message application properties.
    - The `component` attribute was removed from all spans.



  Version 7.10.0 is our first stable release of the Azure Service Bus client library based on a pure Python implemented AMQP stack.



  - A new boolean keyword argument `uamqp_transport` has been added to sync and async `ServiceBusClient` constructors which indicates whether to use the `uamqp` library or the default pure Python AMQP library as the underlying transport.



  - Added the following as dependencies to be used for operations over websocket:
    - `websocket-client` for sync
    - `aiohttp` for async
  - Removed uAMQP from required dependencies and added it as an optional dependency for use with the `uamqp_transport` keyword.



  - Fixed a bug where sync and async `ServiceBusAdministrationClient` expected `credential` with `get_token` method returning `AccessToken.token` of type `bytes` and not `str`, now matching the documentation.
  - Fixed a bug where `raw_amqp_message.header` and `message.header` properties on `ServiceReceivedBusMessage` were returned with `durable`, `first_acquirer`, and `priority` properties set by default, rather than the values returned by the service.
  - Fixed a bug where `ServiceBusReceivedMessage` was not picklable (Issue #27947).



  - The `message` attribute on `ServiceBus`/`ServiceBusMessageBatch`/`ServiceBusReceivedMessage`, which previously exposed the `uamqp.Message`/`uamqp.BatchMessage`, has been deprecated.
    - `LegacyMessage`/`LegacyBatchMessage` objects returned by the `message` attribute on `ServiceBus`/`ServiceBusMessageBatch` have been introduced to help facilitate the transition.
  - Removed uAMQP from required dependencies.
  - Adding `uamqp >= 1.6.3` as an optional dependency for use with the `uamqp_transport` keyword.
   - Updated tracing ([#29995](https://github.com/Azure/azure-sdk-for-python/pull/29995)):
     - Additional attributes added to existing spans:
       - `messaging.system` - messaging system (i.e., `servicebus`)
       - `messaging.operation` - type of operation (i.e., `publish`, `receive`, or `settle`)
       - `messaging.batch.message_count` - number of messages sent or received (if more than one)
     - A span will now be created upon calls to the service that settle messages.
       - The span name will contain the settlement operation (e.g., `ServiceBus.complete`)
       - The span will contain `az.namespace`, `messaging.destination.name`, `net.peer.name`, `messaging.system`, and `messaging.operation` attributes.
     - All `send` spans now contain links to `message` spans. Now, `message` spans will no longer contain a link to the `send` span.





  - A new boolean keyword argument `uamqp_transport` has been added to sync and async `ServiceBusClient` constructors which indicates whether to use the `uamqp` library or the default pure Python AMQP library as the underlying transport.



  - Fixed a bug where sync and async `ServiceBusAdministrationClient` expected `credential` with `get_token` method returning `AccessToken.token` of type `bytes` and not `str`, now matching the documentation.
  - Fixed a bug where `raw_amqp_message.header` and `message.header` properties on `ServiceReceivedBusMessage` were returned with `durable`, `first_acquirer`, and `priority` properties set by default, rather than the values returned by the service.



  - The `message` attribute on `ServiceBus`/`ServiceBusMessageBatch`/`ServiceBusReceivedMessage`, which previously exposed the `uamqp.Message`/`uamqp.BatchMessage`, has been deprecated.
    - `LegacyMessage`/`LegacyBatchMessage` objects returned by the `message` attribute on `ServiceBus`/`ServiceBusMessageBatch` have been introduced to help facilitate the transition.
  - Removed uAMQP from required dependencies.
  - Adding `uamqp >= 1.6.3` as an optional dependency for use with the `uamqp_transport` keyword.





  - Client side validation of input is now disabled by default for the sync and async `ServiceBusAdministrationClient`. This means there will be no `msrest.exceptions.ValidationError` raised by the `ServiceBusAdministrationClient` in the case of malformed input. An `azure.core.exceptions.HttpResponseError` may now be raised if the server refuses the request.



  - Fixed a bug where enum members in `azure.servicebus.management` were not following uppercase convention.



  - All pure Python AMQP stack related changes have been removed and will be added back in the next version.
  - Updated minimum `azure-core` version to 1.24.0.
  - Removed `msrest` dependency.
  - Removed `azure-common` dependency.





  - Iterator receiving from Service Bus entities has been added back in.





  - Fixed a bug where asynchronous method to add distributed tracing attributes was not being awaited (Issue #28738).





  - Fixed a bug that would cause an exception when `None` was sent to `set_state` instead of clearing session state (Issue #27582).



  - Updated uAMQP dependency to 1.6.3.
    - Added support for Python 3.11.



  Version 7.9.0a1 is our first efforts to build an Azure Service Bus client library based on a pure Python implemented AMQP stack.



  - The following features have been temporarily pulled out which will be added back in future previews as we work towards a stable release:
    - Iterator receiving from Service Bus entities.



  - uAMQP dependency is removed.



  This version and all future versions will require Python 3.7+. Python 3.6 is no longer supported.



  - Fixed bug on async `ServiceBusClient` where `custom_endpoint_address` and `connection_verify` kwargs were not being passed through correctly. (Issue #26015)



  This version will be the last version to officially support Python 3.6, future versions will require Python 3.7+.



  - In `ServiceBusClient`, `get_queue_receiver`, `get_subscription_receiver`, `get_queue_sender`, and `get_topic_sender` now accept
  an optional `client_identifier` argument which allows for specifying a custom identifier for the respective sender or receiver. It can
  be useful during debugging as Service Bus associates the id with errors and helps with easier correlation.
  - `ServiceBusReceiver` and `ServiceBusSender` have an added property `client_identifier` which returns the `client_identifier` for the current instance.





  - Fixed bug to make AMQP exceptions retryable by default, if condition is not non-retryable, to ensure that InternalServerErrors are retried.



  - The `ServiceBusClient` constructor now accepts optional `custom_endpoint_address` argument
  which allows for specifying a custom endpoint to use when communicating with the Service Bus service,
  and is useful when your network does not allow communicating to the standard Service Bus endpoint.
  - The `ServiceBusClient`constructor now accepts optional `connection_verify` argument
  which allows for specifying the path to the custom CA_BUNDLE file of the SSL certificate which is used to authenticate
  the identity of the connection endpoint.





  - Improved receiving by releasing messages from internal buffer when the `prefetch_count` of `ServiceBusReceiver`  is set 0 and there is no active receive call, this helps avoid receiving expired messages and incrementing delivery count of a message.





  - Introduce `ServiceBusMessageState` enum that can assume the values of `active`, `scheduled` or `deferred`.
  - Add `state` property in `ServiceBusReceivedMessage`.



  This version and all future versions will require Python 3.6+. Python 2.7 is no longer supported.



  - Added support for fixed (linear) retry backoff:
    - Sync/async `ServiceBusClient` constructors and `from_connection_string` take `retry_mode` as a keyword argument.
  - Added new enum class `ServiceBusSessionFilter`, which is the type of existing `NEXT_AVAILABLE_SESSION` value.



  - Fixed bug that when setting `ServiceBusMessage.time_to_live` with value being `datetime.timedelta`, `total_seconds` should be respected (PR #21869, thanks @jyggen).



  - Improved token refresh timing to prevent potentially blocking main flow when the token is about to get expired soon.
  - Updated uAMQP dependency to 1.5.1.





  - GA the support to create and update queues and topics of large message size to `ServiceBusAdministrationClient`. This feature is only available for Service Bus of Premium Tier.
    - Methods`create_queue`, `create_topic`, `update_queue`, `update_topic` on `ServiceBusAdministrationClient` now take a new keyword argument `max_message_size_in_kilobytes`.
    - `QueueProperties` and `TopicProperties` now have a new instance variable `max_message_size_in_kilobytes`.
  - The constructor of`ServiceBusAdministrationClient` as well as `ServiceBusAdministrationClient.from_connection_string` now take keyword argument `api_version` to configure the Service Bus API version. Supported service versions are "2021-05" and "2017-04".
  - Added new enum class `azure.servicebus.management.ApiVersion` to represent the supported Service Bus API versions.



  - Fixed bug that `ServiceBusReceiver` can not connect to sessionful entity with session id being empty string.
  - Fixed bug that `ServiceBusMessage.partition_key` can not parse empty string properly.





  - Added support to create and update queues and topics of large message size to `ServiceBusAdministrationClient`. This feature is only available for Service Bus of Premium Tier.
    - Methods`create_queue`, `create_topic`, `update_queue`, `update_topic` on `ServiceBusAdministrationClient` now take a new keyword argument `max_message_size_in_kilobytes`.
    - `QueueProperties` and `TopicProperties` now have a new instance variable `max_message_size_in_kilobytes`.





  - Updated uAMQP dependency to 1.4.3.
    - Added support for Python 3.10.
    - Fixed memory leak in win32 socketio and tlsio (issue #19777).
    - Fixed memory leak in the process of converting AMQPValue into string (issue #19777).





  - Improved memory usage of `ServiceBusClient` to automatically discard spawned `ServiceBusSender` or `ServiceBusReceiver` from its handler set when no strong reference to the sender or receiver exists anymore.
  - Reduced CPU load of `azure.servicebus.AutoLockRenewer` during lock renewal.





  - Fixed a bug that `azure.servicebus.aio.AutoLockRenewer` crashes on disposal if no messages have been registered (#19642).
  - Fixed a bug that `azure.servicebus.AutoLockRenewer` only supports auto lock renewal for `max_workers` amount of messages/sessions at a time (#19362).





  - Fixed a bug that when setting `ServiceBusMessage.partition_key`, input value should be not validated against `session_id` of None (PR #19233, thanks @bishnu-shb).
  - Fixed a bug that setting `ServiceBusMessage.time_to_live` causes OverflowError error on Ubuntu 20.04.
  - Fixed a bug that `AmqpAnnotatedProperties.creation_time` and `AmqpAnnotatedProperties.absolute_expiry_time` should be calculated in the unit of milliseconds instead of seconds.
  - Updated uAMQP dependency to 1.4.1.
    - Fixed a bug that attributes creation_time, absolute_expiry_time and group_sequence on MessageProperties should be compatible with integer types on Python 2.7.



  **New Features**

  - Support for sending AMQP annotated message which allows full access to the AMQP message fields is now GA.
    - Introduced new namespace `azure.servicebus.amqp`.
    - Introduced new classes `azure.servicebus.amqp.AmqpMessageHeader` and `azure.servicebus.amqp.AmqpMessageProperties` for accessing amqp header and properties.

  **Breaking Changes from 7.2.0b1**
    - Renamed and moved `azure.servicebus.AMQPAnnotatedMessage` to `azure.servicebus.amqp.AmqpAnnotatedMessage`.
    - Renamed and moved `azure.servicebus.AMQPMessageBodyType` to `azure.servicebus.amqp.AmqpMessageBodyType`.
    - `AmqpAnnotatedMessage.header` returns `azure.servicebus.amqp.AmqpMessageHeader` instead of `uamqp.message.MessageHeader`.
    - `AmqpAnnotatedMessage.properties` returns `azure.servicebus.amqp.AmqpMessageProperties` instead of `uamqp.message.MessageProperties`.
    - `raw_amqp_message` on `ServiceBusMessage` and `ServiceBusReceivedMessage` is now a read-only property instead of an instance variable.

  **Bug Fixes**

  * Fixed a bug that `ServiceBusReceiver` iterator stops iteration after recovery from connection error (#18795).



  The preview features related to AMQPAnnotatedMessage introduced in 7.2.0b1 are not included in this version.

  **New Features**

  * Added support for using `azure.core.credentials.AzureNamedKeyCredential` as credential for authenticating the clients.
  * Support for using `azure.core.credentials.AzureSasCredential` as credential for authenticating the clients is now GA.
  * `ServiceBusAdministrationClient.update_*` methods now accept keyword arguments to override the properties specified in the model instance.

  **Bug Fixes**

  * Fixed a bug where `update_queue` and `update_subscription` methods were mutating the properties `forward_to` and `forward_dead_lettered_messages_to` of the model instance when those properties are entities instead of full paths.
  * Improved the `repr` on `ServiceBusMessage` and `ServiceBusReceivedMessage` to show more meaningful text.
  * Updated uAMQP dependency to 1.4.0.
    - Fixed memory leaks in the process of link attach where source and target cython objects are not properly deallocated (#15747).
    - Improved management operation callback not to parse description value of non AMQP_TYPE_STRING type as string (#18361).

  **Notes**

  * Updated azure-core dependency to 1.14.0.



  **New Features**

  * Added support for using `azure.core.credentials.AzureSasCredential` as credential for authenticating the clients.
  * Added support for sending AMQP annotated message which allows full access to the AMQP message fields.
    -`azure.servicebus.AMQPAnnotatedMessage` is now made public and could be instantiated for sending.
  * Added new enum class `azure.servicebus.AMQPMessageBodyType` to represent the body type of the message message which includes:
    - `DATA`: The body of message consists of one or more data sections and each section contains opaque binary data.
    - `SEQUENCE`: The body of message consists of one or more sequence sections and each section contains an arbitrary number of structured data elements.
    - `VALUE`: The body of message consists of one amqp-value section and the section contains a single AMQP value.
  * Added new property `body_type` on `azure.servicebus.ServiceBusMessage` and `azure.servicebus.ReceivedMessage` which returns `azure.servicebus.AMQPMessageBodyType`.



  This version and all future versions will require Python 2.7 or Python 3.6+, Python 3.5 is no longer supported.

  **New Features**

  * Updated `forward_to` and `forward_dead_lettered_messages_to` parameters in `create_queue`, `update_queue`, `create_subscription`, and `update_subscription` methods on sync and async `ServiceBusAdministrationClient` to accept entities as well, rather than only full paths. In the case that an entity is passed in, it is assumed that the entity exists within the same namespace used for constructing the `ServiceBusAdministrationClient`.

  **Bug Fixes**

  * Updated uAMQP dependency to 1.3.0.
    - Fixed bug that sending message of large size triggering segmentation fault when the underlying socket connection is lost (#13739, #14543).
    - Fixed bug in link flow control where link credit and delivery count should be calculated based on per message instead of per transfer frame (#16934).



  This version will be the last version to officially support Python 3.5, future versions will require Python 2.7 or Python 3.6+.

  **New Features**

  * Updated the following methods so that lists and single instances of Mapping representations are accepted for corresponding strongly-typed object arguments (PR #14807, thanks @bradleydamato):
    - `update_queue`, `update_topic`, `update_subscription`, and `update_rule` on `ServiceBusAdministrationClient` accept Mapping representations of `QueueProperties`, `TopicProperties`, `SubscriptionProperties`, and `RuleProperties`, respectively.
    - `send_messages` and `schedule_messages` on both sync and async versions of `ServiceBusSender` accept a list of or single instance of Mapping representations of `ServiceBusMessage`.
    - `add_message` on `ServiceBusMessageBatch` now accepts a Mapping representation of `ServiceBusMessage`.

  **BugFixes**

  * Operations failing due to `uamqp.errors.LinkForceDetach` caused by no activity on the connection for 10 minutes will now be retried internally except for the session receiver case.
  * `uamqp.errors.AMQPConnectionError` errors with condition code `amqp:unknown-error` are now categorized into `ServiceBusConnectionError` instead of the general `ServiceBusError`.
  * The `update_*` methods on `ServiceBusManagementClient` will now raise a `TypeError` rather than an `AttributeError` in the case of unsupported input type.



  **BugFixes**

  * `forward_to` and `forward_dead_lettered_messages_to` will no longer cause authorization errors when used in `ServiceBusAdministrationClient` for queues and subscriptions (#15543).
  * Updated uAMQP dependency to 1.2.13.
    - Fixed bug that macOS was unable to detect network error (#15473).
    - Fixed bug that `uamqp.ReceiveClient` and `uamqp.ReceiveClientAsync` receive messages during connection establishment (#15555).
    - Fixed bug where connection establishment on macOS with Clang 12 triggering unrecognized selector exception (#15567).
    - Fixed bug in accessing message properties triggering segmentation fault when the underlying C bytes are NULL (#15568).



  > **Note:** This is the GA release of the `azure-servicebus` package, rolling out the official API surface area constructed over the prior preview releases.  Users migrating from `v0.50` are advised to view the [migration guide](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/migration_guide.md).

  **New Features**

  * `sub_queue` and `receive_mode` may now be passed in as a valid string (as defined by their respective enum type) as well as their enum form when constructing `ServiceBusReceiver`.
  * Added support for Distributed Tracing of send, receive, and schedule scenarios.

  **Breaking Changes**

  * `ServiceBusSender` and `ServiceBusReceiver` are no longer reusable and will raise `ValueError` when trying to operate on a closed handler.
  * Rename `ReceiveMode` to `ServiceBusReceiveMode` and `SubQueue` to `ServiceBusSubQueue`, and convert their enum values from ints to human-readable strings.
  * Rename enum values `DeadLetter` to `DEAD_LETTER`, `TransferDeadLetter` to `TRANSFER_DEAD_LETTER`, `PeekLock` to `PEEK_LOCK` and `ReceiveAndDelete` to `RECEIVE_AND_DELETE` to conform to sdk guidelines going forward.
  * `send_messages`, `schedule_messages`, `cancel_scheduled_messages` and `receive_deferred_messages` now performs a no-op rather than raising a `ValueError` if provided an empty list of messages or an empty batch.
  * `ServiceBusMessage.amqp_annotated_message` has been renamed to `ServiceBusMessage.raw_amqp_message` to normalize with other SDKs.
  * Redesigned error hierarchy based on the service-defined error condition:
    - `MessageAlreadySettled` now inherits from `ValueError` instead of `ServiceBusMessageError` as it's a client-side validation.
    - Removed `NoActiveSession` which is now replaced by `OperationTimeoutError` as the client times out when trying to connect to any available session.
    - Removed `ServiceBusMessageError` as error condition based exceptions provide comprehensive error information.
    - Removed `MessageSettleFailed` as error condition based exceptions provide comprehensive error information.
    - Removed `MessageSendFailed` as error condition based exceptions provide comprehensive error information.
    - Renamed `MessageContentTooLarge` to `MessageSizeExceededError` to be consistent with the term defined by the service.
    - Renamed `MessageLockExpired` to `MessageLockLostError` to be consistent with the term defined by the service.
    - Renamed `SessionLockExpired` to `SessionLockLostError` to be consistent with the term defined by the service.
    - Introduced `MessageNotFoundError` which would be raised when the requested message was not found.
    - Introduced `MessagingEntityNotFoundError` which would be raised when a Service Bus resource cannot be found by the Service Bus service.
    - Introduced `MessagingEntityDisabledError` which would be raised when the Messaging Entity is disabled.
    - Introduced `MessagingEntityAlreadyExistsError` which would be raised when an entity with the same name exists under the same namespace.
    - Introduced `ServiceBusQuotaExceededError` which would be raised when a Service Bus resource has been exceeded while interacting with the Azure Service Bus service.
    - Introduced `ServiceBusServerBusyError` which would be raised when the Azure Service Bus service reports that it is busy in response to a client request to perform an operation.
    - Introduced `ServiceBusCommunicationError` which would be raised when there was a general communications error encountered when interacting with the Azure Service Bus service.
    - Introduced `SessionCannotBeLockedError` which would be raised when the requested session cannot be locked.
  * Introduced new client side validation on certain use cases:
    - `ServiceBusMessage` will now raise a `TypeError` when provided an invalid body type.  Valid bodies are strings, bytes, and None.  Lists are no longer accepted, as they simply concatenated the contents prior.
    - An improper `receive_mode` value will now raise `ValueError` instead of `TypeError` in line with supporting extensible enums.
    - Setting `ServiceBusMessage.partition_key` to a value different than `session_id` on the message instance now raises `ValueError`.
    - `ServiceBusClient.get_queue/topic_sender` and `ServiceBusClient.get_queue/subscription_receiver` will now
  raise `ValueError` if the `queue_name` or `topic_name` does not match the `EntityPath` in the connection string used to construct the `ServiceBusClient`.
    - Settling a message that has been peeked will raise `ValueError`.
    - Settling a message or renewing a lock on a message received in `RECEIVE_AND_DELETE` receive mode will raise `ValueError`.
    - Setting `session_id`, `reply_to_session_id`, `message_id` and `partition_key` on `ServiceBusMessage` longer than 128 characters will raise `ValueError`.
  * `ServiceBusReceiver.get_streaming_message_iter` has been made internal for the time being to assess use patterns before committing to back-compatibility; messages may still be iterated over in equivalent fashion by iterating on the receiver itself.

  **BugFixes**

  * `ServiceBusAdministrationClient.create_rule` by default now creates a `TrueRuleFilter` rule.
  * FQDNs and Connection strings are now supported even with strippable whitespace or protocol headers (e.g. 'sb://').
  * Using parameter `auto_lock_renewer` on a sessionful receiver alongside `ReceiveMode.ReceiveAndDelete` will no longer fail during receipt due to failure to register the message with the renewer.



  **New Features**

  * Added support for `timeout` parameter on the following operations:
    - `ServiceBusSender`: `send_messages`, `schedule_messages` and `cancel_scheduled_messages`
    - `ServiceBusReceiver`: `receive_deferred_messages`, `peek_messages` and `renew_message_lock`
    - `ServiceBusSession`: `get_state`, `set_state` and `renew_lock`
  * `azure.servicebus.exceptions.ServiceBusError` now inherits from `azure.core.exceptions.AzureError`.
  * Added a `parse_connection_string` method which parses a connection string into a properties bag containing its component parts
  * Add support for `auto_lock_renewer` parameter on `get_queue_receiver` and `get_subscription_receiver` calls to allow auto-registration of messages and sessions for auto-renewal.

  **Breaking Changes**

  * Renamed `AutoLockRenew` to `AutoLockRenewer`.
  * Removed class `ServiceBusSessionReceiver` which is now unified within class `ServiceBusReceiver`.
    - Removed methods `ServiceBusClient.get_queue_session_receiver` and `ServiceBusClient.get_subscription_session_receiver`.
    - `ServiceBusClient.get_queue_receiver` and `ServiceBusClient.get_subscription_receiver` now take keyword parameter `session_id` which must be set when getting a receiver for the sessionful entity.
  * The parameter `inner_exception` that `ServiceBusError.__init__` takes is now renamed to `error`.
  * Renamed `azure.servicebus.exceptions.MessageError` to `azure.servicebus.exceptions.ServiceBusMessageError`
  * Removed error `azure.servicebus.exceptions.ServiceBusResourceNotFound` as `azure.core.exceptions.ResourceNotFoundError` is now raised when a Service Bus
  resource does not exist when using the `ServiceBusAdministrationClient`.
  * Renamed `Message` to `ServiceBusMessage`.
  * Renamed `ReceivedMessage` to `ServiceBusReceivedMessage`.
  * Renamed `BatchMessage` to `ServiceBusMessageBatch`.
    - Renamed method `add` to `add_message` on the class.
  * Removed class `PeekedMessage`.
  * Removed class `ReceivedMessage` under module `azure.servicebus.aio`.
  * Renamed `ServiceBusSender.create_batch` to `ServiceBusSender.create_message_batch`.
  * Exceptions `MessageSendFailed`, `MessageSettleFailed` and `MessageLockExpired`
   now inherit from `azure.servicebus.exceptions.ServiceBusMessageError`.
  * `get_state` in `ServiceBusSession` now returns `bytes` instead of a `string`.
  * `ServiceBusReceiver.receive_messages/get_streaming_message_iter` and
   `ServiceBusClient.get_<queue/subscription>_receiver` now raises ValueError if the given `max_wait_time` is less than or equal to 0.
  * Message settlement methods are moved from `ServiceBusMessage` to `ServiceBusReceiver`:
    - Use `ServiceBusReceiver.complete_message` instead of `ServiceBusReceivedMessage.complete` to complete a message.
    - Use `ServiceBusReceiver.abandon_message` instead of `ServiceBusReceivedMessage.abandon` to abandon a message.
    - Use `ServiceBusReceiver.defer_message` instead of `ServiceBusReceivedMessage.defer` to defer a message.
    - Use `ServiceBusReceiver.dead_letter_message` instead of `ServiceBusReceivedMessage.dead_letter` to dead letter a message.
  * Message settlement methods (`complete_message`, `abandon_message`, `defer_message` and `dead_letter_message`)
  and methods that use amqp management link for request like `schedule_messages`, `received_deferred_messages`, etc.
  now raise more concrete exception other than `MessageSettleFailed` and `ServiceBusError`.
  * Message `renew_lock` method is moved from `ServiceBusMessage` to `ServiceBusReceiver`:
    - Changed `ServiceBusReceivedMessage.renew_lock` to `ServiceBusReceiver.renew_message_lock`
  * `AutoLockRenewer.register` now takes `ServiceBusReceiver` as a positional parameter.
  * Removed `encoding` support from `ServiceBusMessage`.
  * `ServiceBusMessage.amqp_message` has been renamed to `ServiceBusMessage.amqp_annotated_message` for cross-sdk consistency.
  * All `name` parameters in `ServiceBusAdministrationClient` are now precisely specified ala `queue_name` or `rule_name`
  * `ServiceBusMessage.via_partition_key` is no longer exposed, this is pending a full implementation of transactions as it has no external use. If needed, the underlying value can still be accessed in `ServiceBusMessage.amqp_annotated_message.annotations`.
  * `ServiceBusMessage.properties` has been renamed to `ServiceBusMessage.application_properties` for consistency with service verbiage.
  * Sub-client (`ServiceBusSender` and `ServiceBusReceiver`) `from_connection_string` initializers have been made internal until needed. Clients should be initialized from root `ServiceBusClient`.
  * `ServiceBusMessage.label` has been renamed to `ServiceBusMessage.subject`.
  * `ServiceBusMessage.amqp_annotated_message` has had its type renamed from `AMQPMessage` to `AMQPAnnotatedMessage`
  * `AutoLockRenewer` `timeout` parameter is renamed to `max_lock_renew_duration`
  * Attempting to autorenew a non-renewable message, such as one received in `ReceiveAndDelete` mode, or configure auto-autorenewal on a `ReceiveAndDelete` receiver, will raise a `ValueError`.
  * The default value of parameter `max_message_count` on `ServiceBusReceiver.receive_messages` is now `1` instead of `None` and will raise ValueError if the given value is less than or equal to 0.

  **BugFixes**

  * Updated uAMQP dependency to 1.2.12.
    - Added support for Python 3.9.
    - Fixed bug where amqp message `footer` and `delivery_annotation` were not encoded into the outgoing payload.



  **Breaking Changes**

  * Passing any type other than `ReceiveMode` as parameter `receive_mode` now throws a `TypeError` instead of `AttributeError`.
  * Administration Client calls now take only entity names, not `<Entity>Descriptions` as well to reduce ambiguity in which entity was being acted on. TypeError will now be thrown on improper parameter types (non-string).
  * `AMQPMessage` (`Message.amqp_message`) properties are now read-only, changes of these properties would not be reflected in the underlying message.  This may be subject to change before GA.



  **New Features**

  * `renew_lock()` now returns the UTC datetime that the lock is set to expire at.
  * `receive_deferred_messages()` can now take a single sequence number as well as a list of sequence numbers.
  * Messages can now be sent twice in succession.
  * Connection strings used with `from_connection_string` methods now support using the `SharedAccessSignature` key in leiu of `sharedaccesskey` and `sharedaccesskeyname`, taking the string of the properly constructed token as value.
  * Internal AMQP message properties (header, footer, annotations, properties, etc) are now exposed via `Message.amqp_message`

  **Breaking Changes**

  * Renamed `prefetch` to `prefetch_count`.
  * Renamed `ReceiveSettleMode` enum to `ReceiveMode`, and respectively the `mode` parameter to `receive_mode`.
  * `retry_total`, `retry_backoff_factor` and `retry_backoff_max` are now defined at the `ServiceBusClient` level and inherited by senders and receivers created from it.
  * No longer export `NEXT_AVAILABLE` in `azure.servicebus` module.  A null `session_id` will suffice.
  * Renamed parameter `message_count` to `max_message_count` as fewer messages may be present for method `peek_messages()` and `receive_messages()`.
  * Renamed `PeekMessage` to `PeekedMessage`.
  * Renamed `get_session_state()` and `set_session_state()` to `get_state()` and `set_state()` accordingly.
  * Renamed parameter `description` to `error_description` for method `dead_letter()`.
  * Renamed properties `created_time` and `modified_time` to `created_at_utc` and `modified_at_utc` within `AuthorizationRule` and `NamespaceProperties`.
  * Removed parameter `requires_preprocessing` from `SqlRuleFilter` and `SqlRuleAction`.
  * Removed property `namespace_type` from `NamespaceProperties`.
  * Rename `ServiceBusManagementClient` to `ServiceBusAdministrationClient`
  * Attempting to call `send_messages` on something not a `Message`, `BatchMessage`, or list of `Message`s, will now throw a `TypeError` instead of `ValueError`
  * Sending a message twice will no longer result in a MessageAlreadySettled exception.
  * `ServiceBusClient.close()` now closes spawned senders and receivers.
  * Attempting to initialize a sender or receiver with a different connection string entity and specified entity (e.g. `queue_name`) will result in an AuthenticationError
  * Remove `is_anonymous_accessible` from management entities.
  * Remove `support_ordering` from `create_queue` and `QueueProperties`
  * Remove `enable_subscription_partitioning` from `create_topic` and `TopicProperties`
  * `get_dead_letter_[queue,subscription]_receiver()` has been removed.  To connect to a dead letter queue, utilize the `sub_queue` parameter of `get_[queue,subscription]_receiver()` provided with a value from the `SubQueue` enum
  * No longer export `ServiceBusSharedKeyCredential`
  * Rename `entity_availability_status` to `availability_status`



  **New Features**

  * Added new properties to Message, PeekMessage and ReceivedMessage: `content_type`, `correlation_id`, `label`,
  `message_id`, `reply_to`, `reply_to_session_id` and `to`. Please refer to the docstring for further information.
  * Added new properties to PeekMessage and ReceivedMessage: `enqueued_sequence_number`, `dead_letter_error_description`,
  `dead_letter_reason`, `dead_letter_source`, `delivery_count` and `expires_at_utc`. Please refer to the docstring for further information.
  * Added support for sending received messages via `ServiceBusSender.send_messages`.
  * Added `on_lock_renew_failure` as a parameter to `AutoLockRenew.register`, taking a callback for when the lock is lost non-intentially (e.g. not via settling, shutdown, or autolockrenew duration completion).
  * Added new supported value types int, float, datetime and timedelta for `CorrelationFilter.properties`.
  * Added new properties `parameters` and `requires_preprocessing` to `SqlRuleFilter` and `SqlRuleAction`.
  * Added an explicit method to fetch the continuous receiving iterator, `get_streaming_message_iter()` such that `max_wait_time` can be specified as an override.

  **Breaking Changes**

  * Removed/Renamed several properties and instance variables on Message (the changes applied to the inherited Message type PeekMessage and ReceivedMessage).
    - Renamed property `user_properties` to `properties`
        - The original instance variable `properties` which represents the AMQP properties now becomes an internal instance variable `_amqp_properties`.
    - Removed property `enqueue_sequence_number`.
    - Removed property `annotations`.
    - Removed instance variable `header`.
  * Removed several properties and instance variables on PeekMessage and ReceivedMessage.
    - Removed property `partition_id` on both type.
    - Removed property `settled` on both type.
    - Removed instance variable `received_timestamp_utc` on both type.
    - Removed property `settled` on `PeekMessage`.
    - Removed property `expired` on `ReceivedMessage`.
  * `AutoLockRenew.sleep_time` and `AutoLockRenew.renew_period` have been made internal as `_sleep_time` and `_renew_period` respectively, as it is not expected a user will have to interact with them.
  * `AutoLockRenew.shutdown` is now `AutoLockRenew.close` to normalize with other equivalent behaviors.
  * Renamed `QueueDescription`, `TopicDescription`, `SubscriptionDescription` and `RuleDescription` to `QueueProperties`, `TopicProperties`, `SubscriptionProperties`, and `RuleProperties`.
  * Renamed `QueueRuntimeInfo`, `TopicRuntimeInfo`, and `SubscriptionRuntimeInfo` to `QueueRuntimeProperties`, `TopicRuntimeProperties`, and `SubscriptionRuntimeProperties`.
  * Removed param `queue` from `create_queue`, `topic` from `create_topic`, `subscription` from `create_subscription` and `rule` from `create_rule`
   of `ServiceBusManagementClient`. Added param `name` to them and keyword arguments for queue properties, topic properties, subscription properties and rule properties.
  * Removed model class attributes related keyword arguments from `update_queue` and `update_topic` of `ServiceBusManagementClient`. This is to encourage utilizing the model class instance instead as returned from a create_\*, list_\* or get_\* operation to ensure it is properly populated.  Properties may still be modified.
  * Model classes `QueueProperties`, `TopicProperties`, `SubscriptionProperties` and `RuleProperties` require all arguments to be present for creation.  This is to protect against lack of partial updates by requiring all properties to be specified.
  * Renamed `idle_timeout` in `get_<queue/subscription>_receiver()` to `max_wait_time` to normalize with naming elsewhere.
  * Updated uAMQP dependency to 1.2.10 such that the receiver does not shut down when generator times out, and can be received from again.



  **New Features**

  * Added support for management of topics, subscriptions, and rules.
  * `receive_messages()` (formerly `receive()`) now supports receiving a batch of messages (`max_batch_size` > 1) without the need to set `prefetch` parameter during `ServiceBusReceiver` initialization.

  **BugFixes**

  * Fixed bug where sync `AutoLockRenew` does not shutdown itself timely.
  * Fixed bug where async `AutoLockRenew` does not support context manager.

  **Breaking Changes**

  * Renamed `receive()`, `peek()` `schedule()` and `send()` to `receive_messages()`, `peek_messages()`, `schedule_messages()` and `send_messages()` to align with other service bus SDKs.
  * `receive_messages()` (formerly `receive()`) no longer raises a `ValueError` if `max_batch_size` is less than the `prefetch` parameter set during `ServiceBusReceiver` initialization.



  **New Features**

  * Added support for management of queue entities.
      - Use `azure.servicebus.management.ServiceBusManagementClient` (`azure.servicebus.management.aio.ServiceBusManagementClient` for aio) to create, update, delete, list queues and get settings as well as runtime information of queues under a ServiceBus namespace.
  * Added methods `get_queue_deadletter_receiver` and `get_subscription_deadletter_receiver` in `ServiceBusClient` to get a `ServiceBusReceiver` for the dead-letter sub-queue of the target entity.

  **BugFixes**

  * Updated uAMQP dependency to 1.2.8.
      * Fixed bug where reason and description were not being set when dead-lettering messages.



  **New Features**

  * Added method `get_topic_sender` in `ServiceBusClient` to get a `ServiceBusSender` for a topic.
  * Added method `get_subscription_receiver` in `ServiceBusClient` to get a `ServiceBusReceiver` for a subscription under specific topic.
  * Added support for scheduling messages and scheduled message cancellation.
      - Use `ServiceBusSender.schedule(messages, schedule_time_utc)` for scheduling messages.
      - Use `ServiceBusSender.cancel_scheduled_messages(sequence_numbers)` for scheduled messages cancellation.
  * `ServiceBusSender.send()` can now send a list of messages in one call, if they fit into a single batch.  If they do not fit a `ValueError` is thrown.
  * `BatchMessage.add()` and `ServiceBusSender.send()` would raise `MessageContentTooLarge` if the content is over-sized.
  * `ServiceBusReceiver.receive()` raises `ValueError` if its param `max_batch_size` is greater than param `prefetch` of `ServiceBusClient`.
  * Added exception classes `MessageError`, `MessageContentTooLarge`, `ServiceBusAuthenticationError`.
     - `MessageError`: when you send a problematic message, such as an already sent message or an over-sized message.
     - `MessageContentTooLarge`: when you send an over-sized message. A subclass of `ValueError` and `MessageError`.
     - `ServiceBusAuthenticationError`: on failure to be authenticated by the service.
  * Removed exception class `InvalidHandlerState`.

  **BugFixes**

  * Fixed bug where http_proxy and transport_type in ServiceBusClient are not propagated into Sender/Receiver creation properly.
  * Updated uAMQP dependency to 1.2.7.
      * Fixed bug in setting certificate of tlsio on MacOS. #7201
      * Fixed bug that caused segmentation fault in network tracing on MacOS when setting `logging_enable` to `True` in `ServiceBusClient`.

  **Breaking Changes**

  * Session receivers are now created via their own top level functions, e.g. `get_queue_sesison_receiver` and `get_subscription_session_receiver`.  Non session receivers no longer take session_id as a paramter.
  * `ServiceBusSender.send()` no longer takes a timeout parameter, as it should be redundant with retry options provided when creating the client.
  * Exception imports have been removed from module `azure.servicebus`. Import from `azure.servicebus.exceptions` instead.
  * `ServiceBusSender.schedule()` has swapped the ordering of parameters `schedule_time_utc` and `messages` for better consistency with `send()` syntax.



  Version 7.0.0b1 is a preview of our efforts to create a client library that is user friendly and idiomatic to the Python ecosystem. The reasons for most of the changes in this update can be found in the Azure SDK Design Guidelines for Python. For more information, please visit https://aka.ms/azure-sdk-preview1-python.
  * Note: Not all historical functionality exists in this version at this point.  Topics, Subscriptions, scheduling, dead_letter management and more will be added incrementally over upcoming preview releases.

  **New Features**

  * Added new configuration parameters when creating `ServiceBusClient`.
      * `credential`: The credential object used for authentication which implements `TokenCredential` interface of getting tokens.
      * `http_proxy`: A dictionary populated with proxy settings.
      * For detailed information about configuration parameters, please see docstring in `ServiceBusClient` and/or the reference documentation for more information.
  * Added support for authentication using Azure Identity credentials.
  * Added support for retry policy.
  * Added support for http proxy.
  * Manually calling `reconnect` should no longer be necessary, it is now performed implicitly.
  * Manually calling `open` should no longer be necessary, it is now performed implicitly.
      * Note: `close()`-ing is still required if a context manager is not used, to avoid leaking connections.
  * Added support for sending a batch of messages destined for heterogenous sessions.

  **Breaking changes**

  * Simplified API and set of clients
      * `get_queue` no longer exists, utilize `get_queue_sender/receiver` instead.
      * `peek` and other `queue_client` functions have moved to their respective sender/receiver.
      * Renamed `fetch_next` to `receive`.
      * Renamed `session` to `session_id` to normalize naming when requesting a receiver against a given session.
      * `reconnect` no longer exists, and is performed implicitly if needed.
      * `open` no longer exists, and is performed implicitly if needed.
  * Normalized top level client parameters with idiomatic and consistent naming.
      * Renamed `debug` in `ServiceBusClient` initializer to `logging_enable`.
      * Renamed `service_namespace` in `ServiceBusClient` initializer to `fully_qualified_namespace`.
  * New error hierarchy, with more specific semantics
      * `azure.servicebus.exceptions.ServiceBusError`
      * `azure.servicebus.exceptions.ServiceBusConnectionError`
      * `azure.servicebus.exceptions.ServiceBusResourceNotFound`
      * `azure.servicebus.exceptions.ServiceBusAuthorizationError`
      * `azure.servicebus.exceptions.NoActiveSession`
      * `azure.servicebus.exceptions.OperationTimeoutError`
      * `azure.servicebus.exceptions.InvalidHandlerState`
      * `azure.servicebus.exceptions.AutoLockRenewTimeout`
      * `azure.servicebus.exceptions.AutoLockRenewFailed`
      * `azure.servicebus.exceptions.EventDataSendError`
      * `azure.servicebus.exceptions.MessageSendFailed`
      * `azure.servicebus.exceptions.MessageLockExpired`
      * `azure.servicebus.exceptions.MessageSettleFailed`
      * `azure.servicebus.exceptions.MessageAlreadySettled`
      * `azure.servicebus.exceptions.SessionLockExpired`
  * BatchMessage creation is now initiated via `create_batch` on a Sender, using `add()` on the batch to add messages, in order to enforce service-side max batch sized limitations.
  * Session is now set on the message itself, via `session_id` parameter or property, as opposed to on `Send` or `get_sender` via `session`.  This is to allow sending a batch of messages destined to varied sessions.
  * Session management is now encapsulated within a property of a receiver, e.g. `receiver.session`, to better compartmentalize functionality specific to sessions.
      * To use `AutoLockRenew` against sessions, one would simply pass the inner session object, instead of the receiver itself.



  **New Features**

  * Added support for delivery tag lock tokens

  **BugFixes**

  * Fixed bug where Message would pass through invalid kwargs on init when attempting to thread through subject.
  * Increments UAMQP dependency min version to 1.2.5, to include a set of fixes, including handling of large messages and mitigation of segfaults.



  **BugFixes**

  * Fixed bug where enqueued_time and scheduled_enqueue_time of message being parsed as local timestamp rather than UTC.




  **Breaking changes**

  * Introduces new AMQP-based API.
  * Original HTTP-based API still available under new namespace: azure.servicebus.control_client
  * For full API changes, please see updated [reference documentation](https://docs.microsoft.com/python/api/azure-servicebus/azure.servicebus?view=azure-python).

  Within the new namespace, the original HTTP-based API from version 0.21.1 remains unchanged (i.e. no additional features or bugfixes)
  so for those intending to only use HTTP operations - there is no additional benefit in updating at this time.

  **New Features**

  * New API supports message send and receive via AMQP with improved performance and stability.
  * New asynchronous APIs (using `asyncio`) for send, receive and message handling.
  * Support for message and session auto lock renewal via background thread or async operation.
  * Now supports scheduled message cancellation.




  This wheel package is now built with the azure wheel extension



  **New Features**

  * `str` messages are now accepted in Python 3 and will be encoded in 'utf-8' (will not raise TypeError anymore)
  * `broker_properties` can now be defined as a dict, and not only a JSON `str`. datetime, int, float and boolean are converted.
  * #902 add `send_topic_message_batch` operation (takes an iterable of messages)
  * #902 add `send_queue_message_batch` operation (takes an iterable of messages)

  **Bugfixes**

  * #820 the code is now more robust to unexpected changes on the SB RestAPI



  **News**

  * #547 Add get dead letter path static methods to Python
  * #513 Add renew lock

  **Bugfixes**

  * #628 Fix custom properties with double quotes



  **Bugfixes**

  * New header in Rest API which breaks the SDK #658 #657



  **News**

  * Create a requests.Session() if the user doesn't pass one in.



  Initial release of this package, from the split of the `azure` package.
  See the `azure` package release note for 1.0.0 for details and previous
  history on Service Bus.


pkgId: e5c277e269786b9fe9845aaece9c25e730517c3c899c3c076843b4d2fcde4023
name: python-azure-servicebus
arch: src
version: 7.12.3
epoch: 0
release: 1
summary: Microsoft Azure Service Bus Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-servicebus-7.12.3-1.src.rpm
checksum_type: sha256
description:
  Azure Service Bus is a high performance cloud-managed messaging service for providing real-time and fault-tolerant communication between distributed senders and receivers.

  Service Bus provides multiple mechanisms for asynchronous highly reliable communication, such as structured first-in-first-out messaging,
  publish/subscribe capabilities, and the ability to easily scale as your needs grow.

  Use the Service Bus client library for Python to communicate between applications and services and implement asynchronous messaging patterns.

  * Create Service Bus namespaces, queues, topics, and subscriptions, and modify their settings.
  * Send and receive messages within your Service Bus channels.
  * Utilize message locks, sessions, and dead letter functionality to implement complex messaging patterns.

  [Source code](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/)
  | [Package (PyPi)][pypi]
  | [Package (Conda)](https://anaconda.org/microsoft/azure-servicebus)
  | [API reference documentation][api_docs]
  | [Product documentation][product_docs]
  | [Samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples)
  | [Changelog](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/CHANGELOG.md)

  **NOTE**: If you are using version 0.50 or lower and want to migrate to the latest version
  of this package please look at our [migration guide to move from Service Bus V0.50 to Service Bus V7][migration_guide].





  Install the Azure Service Bus client library for Python with [pip][pip]:

  ```Bash
  pip install azure-servicebus
  ```


  To use this package, you must have:
  * Azure subscription - [Create a free account][azure_sub]
  * Azure Service Bus - [Namespace and management credentials][service_bus_namespace]
  * Python 3.8 or later - [Install Python][python]


  If you need an Azure service bus namespace, you can create it via the [Azure Portal][azure_namespace_creation].
  If you do not wish to use the graphical portal UI, you can use the Azure CLI via [Cloud Shell][cloud_shell_bash], or Azure CLI run locally, to create one with this Azure CLI command:

  ```Bash
  az servicebus namespace create --resource-group <resource-group-name> --name <servicebus-namespace-name> --location <servicebus-namespace-location>
  ```



  Interaction with Service Bus starts with an instance of the `ServiceBusClient` class. You either need a **connection string with SAS key**, or a **namespace** and one of its **account keys** to instantiate the client object.
  Please find the samples linked below for demonstration as to how to authenticate via either approach.



  - To obtain the required credentials, one can use the [Azure CLI][azure_cli] snippet (Formatted for Bash Shell) at the top of the linked sample to populate an environment variable with the service bus connection string (you can also find these values in the [Azure Portal][azure_portal] by following the step-by-step guide to [Get a service bus connection string][get_servicebus_conn_str]).



  - This constructor takes the fully qualified namespace of your Service Bus instance and a credential that implements the
  [TokenCredential][token_credential_interface]
  protocol. There are implementations of the `TokenCredential` protocol available in the
  [azure-identity package][pypi_azure_identity]. The fully qualified namespace is of the format `<yournamespace.servicebus.windows.net>`.
  - To use the credential types provided by `azure-identity`, please install the package:
  ```pip install azure-identity```
  - Additionally, to use the async API, you must first install an async transport, such as [`aiohttp`](https://pypi.org/project/aiohttp/):
  ```pip install aiohttp```
  - When using Azure Active Directory, your principal must be assigned a role which allows access to Service Bus, such as the
  Azure Service Bus Data Owner role. For more information about using Azure Active Directory authorization with Service Bus,
  please refer to [the associated documentation][servicebus_aad_authentication].

  >**Note:** client can be initialized without a context manager, but must be manually closed via client.close() to not leak resources.



  Once you've initialized a `ServiceBusClient`, you can interact with the primary resource types within a Service Bus Namespace, of which multiple can exist and on which actual message transmission takes place, the namespace often serving as an application container:

  * [Queue][queue_concept]: Allows for Sending and Receiving of message.  Often used for point-to-point communication.

  * [Topic][topic_concept]: As opposed to Queues, Topics are better suited to publish/subscribe scenarios.  A topic can be sent to, but requires a subscription, of which there can be multiple in parallel, to consume from.

  * [Subscription][subscription_concept]: The mechanism to consume from a Topic.  Each subscription is independent, and receives a copy of each message sent to the topic.  Rules and Filters can be used to tailor which messages are received by a specific subscription.

  For more information about these resources, see [What is Azure Service Bus?][service_bus_overview].

  To interact with these resources, one should be familiar with the following SDK concepts:

  * [ServiceBusClient][client_reference]: This is the object a user should first initialize to connect to a Service Bus Namespace.  To interact with a queue, topic, or subscription, one would spawn a sender or receiver off of this client.

  * [ServiceBusSender][sender_reference]: To send messages to a Queue or Topic, one would use the corresponding `get_queue_sender` or `get_topic_sender` method off of a `ServiceBusClient` instance as seen [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples/sync_samples/send_queue.py).

  * [ServiceBusReceiver][receiver_reference]: To receive messages from a Queue or Subscription, one would use the corresponding `get_queue_receiver` or `get_subscription_receiver` method off of a `ServiceBusClient` instance as seen [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples/sync_samples/receive_queue.py).

  * [ServiceBusMessage][message_reference]: When sending, this is the type you will construct to contain your payload.  When receiving, this is where you will access the payload.



  We do not guarantee that the ServiceBusClient, ServiceBusSender, and ServiceBusReceiver are thread-safe. We do not recommend reusing these instances across threads. It is up to the running application to use these classes in a thread-safe manner.



  The following sections provide several code snippets covering some of the most common Service Bus tasks, including:

  * [Send messages to a queue](#send-messages-to-a-queue "Send messages to a queue")
  * [Receive messages from a queue](#receive-messages-from-a-queue "Receive messages from a queue")
  * [Send and receive a message from a session enabled queue](#send-and-receive-a-message-from-a-session-enabled-queue "Send and receive a message from a session enabled queue")
  * [Working with topics and subscriptions](#working-with-topics-and-subscriptions "Working with topics and subscriptions")
  * [Settle a message after receipt](#settle-a-message-after-receipt "Settle a message after receipt")
  * [Automatically renew Message or Session locks](#automatically-renew-message-or-session-locks "Automatically renew Message or Session locks")

  To perform management tasks such as creating and deleting queues/topics/subscriptions, please utilize the azure-mgmt-servicebus library, available [here][servicebus_management_repository].

  Please find further examples in the [samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples) directory demonstrating common Service Bus scenarios such as sending, receiving, session management and message handling.


  > **NOTE:** see reference documentation [here][send_reference].

  This example sends single message and array of messages to a queue that is assumed to already exist, created via the Azure portal or az commands.

  ```python
  from azure.servicebus import ServiceBusClient, ServiceBusMessage
  from azure.identity import DefaultAzureCredential

  import os
  fully_qualified_namespace = os.environ['SERVICEBUS_FULLY_QUALIFIED_NAMESPACE']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']

  credential = DefaultAzureCredential()
  with ServiceBusClient(fully_qualified_namespace, credential) as client:
      with client.get_queue_sender(queue_name) as sender:
          
          single_message = ServiceBusMessage("Single message")
          sender.send_messages(single_message)

          
          messages = [ServiceBusMessage("First message"), ServiceBusMessage("Second message")]
          sender.send_messages(messages)
  ```

  > **NOTE:** A message may be scheduled for delayed delivery using the `ServiceBusSender.schedule_messages()` method, or by specifying `ServiceBusMessage.scheduled_enqueue_time_utc` before calling `ServiceBusSender.send_messages()`

  > For more detail on scheduling and schedule cancellation please see a sample [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples/sync_samples/schedule_messages_and_cancellation.py).



  To receive from a queue, you can either perform an ad-hoc receive via `receiver.receive_messages()` or receive persistently through the receiver itself.



  ```python
  from azure.servicebus import ServiceBusClient
  from azure.identity import DefaultAzureCredential

  import os
  fully_qualified_namespace = os.environ['SERVICEBUS_FULLY_QUALIFIED_NAMESPACE']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']

  credential = DefaultAzureCredential()
  with ServiceBusClient(fully_qualified_namespace, credential) as client:
      
      
      with client.get_queue_receiver(queue_name, max_wait_time=30) as receiver:
          for msg in receiver:  # ServiceBusReceiver instance is a generator.
              print(str(msg))
              
  ```

  > **NOTE:** Any message received with `receive_mode=PEEK_LOCK` (this is the default, with the alternative RECEIVE_AND_DELETE removing the message from the queue immediately on receipt)
  > has a lock that must be renewed via `receiver.renew_message_lock` before it expires if processing would take longer than the lock duration.
  > See [AutoLockRenewer](#automatically-renew-message-or-session-locks "Automatically renew Message or Session locks") for a helper to perform this in the background automatically.
  > Lock duration is set in Azure on the queue or topic itself.



  > **NOTE:** `ServiceBusReceiver.receive_messages()` receives a single or constrained list of messages through an ad-hoc method call, as opposed to receiving perpetually from the generator. It always returns a list.

  ```python
  from azure.servicebus import ServiceBusClient
  from azure.identity import DefaultAzureCredential

  import os
  fully_qualified_namespace = os.environ['SERVICEBUS_FULLY_QUALIFIED_NAMESPACE']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']

  credential = DefaultAzureCredential()
  with ServiceBusClient(fully_qualified_namespace, credential) as client:
      with client.get_queue_receiver(queue_name) as receiver:
          received_message_array = receiver.receive_messages(max_wait_time=10)  # try to receive a single message within 10 seconds
          if received_message_array:
              print(str(received_message_array[0]))

      with client.get_queue_receiver(queue_name) as receiver:
          received_message_array = receiver.receive_messages(max_message_count=5, max_wait_time=10)  # try to receive maximum 5 messages in a batch within 10 seconds
          for message in received_message_array:
              print(str(message))
  ```

  In this example, max_message_count declares the maximum number of messages to attempt receiving before hitting a max_wait_time as specified in seconds.

  > **NOTE:** It should also be noted that `ServiceBusReceiver.peek_messages()` is subtly different than receiving, as it does not lock the messages being peeked, and thus they cannot be settled.



  > **NOTE:** see reference documentation for session [send][session_send_reference] and [receive][session_receive_reference].

  Sessions provide first-in-first-out and single-receiver semantics on top of a queue or subscription.  While the actual receive syntax is the same, initialization differs slightly.

  ```python
  from azure.servicebus import ServiceBusClient, ServiceBusMessage
  from azure.identity import DefaultAzureCredential

  import os
  fully_qualified_namespace = os.environ['SERVICEBUS_FULLY_QUALIFIED_NAMESPACE']
  queue_name = os.environ['SERVICE_BUS_SESSION_QUEUE_NAME']
  session_id = os.environ['SERVICE_BUS_SESSION_ID']

  credential = DefaultAzureCredential()
  with ServiceBusClient(fully_qualified_namespace, credential) as client:
      with client.get_queue_sender(queue_name) as sender:
          sender.send_messages(ServiceBusMessage("Session Enabled Message", session_id=session_id))

      
      with client.get_queue_receiver(queue_name, session_id=session_id) as receiver:
          for msg in receiver:
              print(str(msg))
  ```

  > **NOTE**: Messages received from a session do not need their locks renewed like a non-session receiver; instead the lock management occurs at the
  > session level with a session lock that may be renewed with `receiver.session.renew_lock()`



  > **NOTE:** see reference documentation for [topics][topic_reference] and [subscriptions][subscription_reference].

  Topics and subscriptions give an alternative to queues for sending and receiving messages.  See documents [here][topic_concept] for more overarching detail,
  and of how these differ from queues.

  ```python
  from azure.servicebus import ServiceBusClient, ServiceBusMessage
  from azure.identity import DefaultAzureCredential


  import os
  fully_qualified_namespace = os.environ['SERVICEBUS_FULLY_QUALIFIED_NAMESPACE']
  topic_name = os.environ['SERVICE_BUS_TOPIC_NAME']
  subscription_name = os.environ['SERVICE_BUS_SUBSCRIPTION_NAME']

  credential = DefaultAzureCredential()
  with ServiceBusClient(fully_qualified_namespace, credential) as client:
      with client.get_topic_sender(topic_name) as sender:
          sender.send_messages(ServiceBusMessage("Data"))

      
      with client.get_subscription_receiver(topic_name, subscription_name) as receiver:
          for msg in receiver:
              print(str(msg))
  ```



  When receiving from a queue, you have multiple actions you can take on the messages you receive.

  > **NOTE**: You can only settle `ServiceBusReceivedMessage` objects which are received in `ServiceBusReceiveMode.PEEK_LOCK` mode (this is the default).
  > `ServiceBusReceiveMode.RECEIVE_AND_DELETE` mode removes the message from the queue on receipt.  `ServiceBusReceivedMessage` messages
  > returned from `peek_messages()` cannot be settled, as the message lock is not taken like it is in the aforementioned receive methods.

  If the message has a lock as mentioned above, settlement will fail if the message lock has expired.
  If processing would take longer than the lock duration, it must be maintained via `receiver.renew_message_lock` before it expires.
  Lock duration is set in Azure on the queue or topic itself.
  See [AutoLockRenewer](#automatically-renew-message-or-session-locks "Automatically renew Message or Session locks") for a helper to perform this in the background automatically.



  Declares the message processing to be successfully completed, removing the message from the queue.

  ```python
  from azure.servicebus import ServiceBusClient
  from azure.identity import DefaultAzureCredential


  import os
  fully_qualified_namespace = os.environ['SERVICEBUS_FULLY_QUALIFIED_NAMESPACE']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']

  credential = DefaultAzureCredential()
  with ServiceBusClient(fully_qualified_namespace, credential) as client:
      with client.get_queue_receiver(queue_name) as receiver:
          for msg in receiver:
              print(str(msg))
              receiver.complete_message(msg)
  ```



  Abandon processing of the message for the time being, returning the message immediately back to the queue to be picked up by another (or the same) receiver.

  ```python
  from azure.servicebus import ServiceBusClient
  from azure.identity import DefaultAzureCredential


  import os
  fully_qualified_namespace = os.environ['SERVICEBUS_FULLY_QUALIFIED_NAMESPACE']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']

  credential = DefaultAzureCredential()
  with ServiceBusClient(fully_qualified_namespace, credential) as client:
      with client.get_queue_receiver(queue_name) as receiver:
          for msg in receiver:
              print(str(msg))
              receiver.abandon_message(msg)
  ```



  Transfer the message from the primary queue into a special "dead-letter sub-queue" where it can be accessed using the `ServiceBusClient.get_<queue|subscription>_receiver` function with parameter `sub_queue=ServiceBusSubQueue.DEAD_LETTER` and consumed from like any other receiver. (see sample [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples/sync_samples/receive_deadlettered_messages.py))

  ```python
  from azure.servicebus import ServiceBusClient
  from azure.identity import DefaultAzureCredential


  import os
  fully_qualified_namespace = os.environ['SERVICEBUS_FULLY_QUALIFIED_NAMESPACE']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']

  credential = DefaultAzureCredential()
  with ServiceBusClient(fully_qualified_namespace, credential) as client:
      with client.get_queue_receiver(queue_name) as receiver:
          for msg in receiver:
              print(str(msg))
              receiver.dead_letter_message(msg)
  ```



  Defer is subtly different from the prior settlement methods.  It prevents the message from being directly received from the queue
  by setting it aside such that it must be received by sequence number in a call to `ServiceBusReceiver.receive_deferred_messages` (see sample [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples/sync_samples/receive_deferred_message_queue.py))

  ```python
  from azure.servicebus import ServiceBusClient
  from azure.identity import DefaultAzureCredential


  import os
  fully_qualified_namespace = os.environ['SERVICEBUS_FULLY_QUALIFIED_NAMESPACE']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']

  credential = DefaultAzureCredential()
  with ServiceBusClient(fully_qualified_namespace, credential) as client:
      with client.get_queue_receiver(queue_name) as receiver:
          for msg in receiver:
              print(str(msg))
              receiver.defer_message(msg)
  ```


  > **NOTE:** see reference documentation for [auto-lock-renewal][autolockrenew_reference].

  `AutoLockRenewer` is a simple method for ensuring your message or session remains locked even over long periods of time, if calling `receiver.renew_message_lock`/`receiver.session.renew_lock` is impractical or undesired.
  Internally, it is not much more than shorthand for creating a concurrent watchdog to do lock renewal if the object is nearing expiry.
  It should be used as follows:

  * Message lock automatic renewing

  ```python
  from azure.servicebus import ServiceBusClient, AutoLockRenewer
  from azure.identity import DefaultAzureCredential


  import os
  fully_qualified_namespace = os.environ['SERVICEBUS_FULLY_QUALIFIED_NAMESPACE']
  queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']


  renewer = AutoLockRenewer()
  credential = DefaultAzureCredential()
  with ServiceBusClient(fully_qualified_namespace, credential) as client:
      with client.get_queue_receiver(queue_name) as receiver:
          for msg in receiver.receive_messages():
              renewer.register(receiver, msg, max_lock_renewal_duration=60)
              
              receiver.complete_message(msg)
  renewer.close()
  ```

  * Session lock automatic renewing

  ```python
  from azure.servicebus import ServiceBusClient, AutoLockRenewer
  from azure.identity import DefaultAzureCredential


  import os
  fully_qualified_namespace = os.environ['SERVICEBUS_FULLY_QUALIFIED_NAMESPACE']
  session_queue_name = os.environ['SERVICE_BUS_SESSION_QUEUE_NAME']
  session_id = os.environ['SERVICE_BUS_SESSION_ID']


  renewer = AutoLockRenewer()
  credential = DefaultAzureCredential()
  with ServiceBusClient(fully_qualified_namespace, credential) as client:
      with client.get_queue_receiver(session_queue_name, session_id=session_id) as receiver:
          renewer.register(receiver, receiver.session, max_lock_renewal_duration=300) # Duration for how long to maintain the lock for, in seconds.

          for msg in receiver.receive_messages():
              
              receiver.complete_message(msg)
  renewer.close()
  ```

  If for any reason auto-renewal has been interrupted or failed, this can be observed via the `auto_renew_error` property on the object being renewed, or by having passed a callback to the `on_lock_renew_failure` parameter on renewer initialization.
  It would also manifest when trying to take action (such as completing a message) on the specified object.





  - Enable `azure.servicebus` logger to collect traces from the library.
  - Enable AMQP frame level trace by setting `logging_enable=True` when creating the client.

  ```python
  import logging
  import sys

  handler = logging.StreamHandler(stream=sys.stdout)
  logger = logging.getLogger('azure.servicebus')
  logger.setLevel(logging.DEBUG)
  logger.addHandler(handler)

  ...

  from azure.servicebus import ServiceBusClient

  client = ServiceBusClient(..., logging_enable=True)
  ```



  There are various timeouts a user should be aware of within the library.
  - 10 minute service side link closure:  A link, once opened, will be closed after 10 minutes idle to protect the service against resource leakage.  This should largely
  be transparent to a user, but if you notice a reconnect occurring after such a duration, this is why.  Performing any operations, including management operations, on the
  link will extend this timeout.
  - max_wait_time: Provided on creation of a receiver or when calling `receive_messages()`, the time after which receiving messages will halt after no traffic.  This applies both to the imperative `receive_messages()` function as well as the length
  a generator-style receive will run for before exiting if there are no messages.  Passing None (default) will wait forever, up until the 10 minute threshold if no other action is taken.

  > **NOTE:** If processing of a message or session is sufficiently long as to cause timeouts, as an alternative to calling `receiver.renew_message_lock`/`receiver.session.renew_lock` manually, one can
  > leverage the `AutoLockRenewer` functionality detailed [above](#automatically-renew-message-or-session-locks "Automatically renew Message or Session locks").



  The Service Bus APIs generate the following exceptions in azure.servicebus.exceptions:

  - **ServiceBusConnectionError:** An error occurred in the connection to the service.
  This may have been caused by a transient network issue or service problem. It is recommended to retry.
  - **ServiceBusAuthorizationError:** An error occurred when authorizing the connection to the service.
  This may have been caused by the credentials not having the right permission to perform the operation.
  It is recommended to check the permission of the credentials.
  - **ServiceBusAuthenticationError:** An error occurred when authenticate the connection to the service.
  This may have been caused by the credentials being incorrect. It is recommended to check the credentials.
  - **OperationTimeoutError:** This indicates that the service did not respond to an operation within the expected amount of time.
  This may have been caused by a transient network issue or service problem. The service may or may not have successfully completed the request; the status is not known.
  It is recommended to attempt to verify the current state and retry if necessary.
  - **MessageSizeExceededError:** This indicate that the message content is larger than the service bus frame size.
  This could happen when too many service bus messages are sent in a batch or the content passed into
  the body of a `Message` is too large. It is recommended to reduce the count of messages being sent in a batch or the size of content being passed into a single `ServiceBusMessage`.
  - **MessageAlreadySettled:** This indicates failure to settle the message.
  This could happen when trying to settle an already-settled message.
  - **MessageLockLostError:** The lock on the message has expired and it has been released back to the queue.
  It will need to be received again in order to settle it.
  You should be aware of the lock duration of a message and keep renewing the lock before expiration in case of long processing time.
  `AutoLockRenewer` could help on keeping the lock of the message automatically renewed.
  - **SessionLockLostError:** The lock on the session has expired.
  All unsettled messages that have been received can no longer be settled.
  It is recommended to reconnect to the session if receive messages again if necessary.
  You should be aware of the lock duration of a session and keep renewing the lock before expiration in case of long processing time.
  `AutoLockRenewer` could help on keeping the lock of the session automatically renewed.
  - **MessageNotFoundError:** Attempt to receive a message with a particular sequence number. This message isn't found.
  Make sure the message hasn't been received already. Check the deadletter queue to see if the message has been deadlettered.
  - **MessagingEntityNotFoundError:** Entity associated with the operation doesn't exist or it has been deleted.
  Please make sure the entity exists.
  - **MessagingEntityDisabledError:** Request for a runtime operation on a disabled entity. Please Activate the entity.
  - **ServiceBusQuotaExceededError:** The messaging entity has reached its maximum allowable size, or the maximum number of connections to a namespace has been exceeded.
  Create space in the entity by receiving messages from the entity or its subqueues.
  - **ServiceBusServerBusyError:** Service isn't able to process the request at this time. Client can wait for a period of time, then retry the operation.
  - **ServiceBusCommunicationError:** Client isn't able to establish a connection to Service Bus.
  Make sure the supplied host name is correct and the host is reachable.
  If your code runs in an environment with a firewall/proxy, ensure that the traffic to the Service Bus domain/IP address and ports isn't blocked.
  - **SessionCannotBeLockedError:** Attempt to connect to a session with a specific session ID, but the session is currently locked by another client.
  Make sure the session is unlocked by other clients.
  - **AutoLockRenewFailed:** An attempt to renew a lock on a message or session in the background has failed.
  This could happen when the receiver used by `AutoLockRenewer` is closed or the lock of the renewable has expired.
  It is recommended to re-register the renewable message or session by receiving the message or connect to the sessionful entity again.
  - **AutoLockRenewTimeout:** The time allocated to renew the message or session lock has elapsed. You could re-register the object that wants be auto lock renewed or extend the timeout in advance.
  - **ServiceBusError:** All other Service Bus related errors. It is the root error class of all the errors described above.

  Please view the [exceptions reference docs][exception_reference] for detailed descriptions of our common Exception types.





  Please find further examples in the [samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples) directory demonstrating common Service Bus scenarios such as sending, receiving, session management and message handling.



  For more extensive documentation on the Service Bus service, see the [Service Bus documentation][service_bus_docs] on docs.microsoft.com.



  For users seeking to perform management operations against ServiceBus (Creating a queue/topic/etc, altering filter rules, enumerating entities)
  please see the [azure-mgmt-servicebus documentation][service_bus_mgmt_docs] for API documentation.  Terse usage examples can be found
  [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-mgmt-servicebus/tests) as well.



  The Azure Service Bus client library is now based on a pure Python AMQP implementation. `uAMQP` has been removed as required dependency.

  To use `uAMQP` as the underlying transport:

  1. Install `uamqp` with pip.

  ```
  $ pip install uamqp
  ```

  2. Pass `uamqp_transport=True` during client construction.

  ```python
  from azure.servicebus import ServiceBusClient
  connection_str = '<< CONNECTION STRING FOR THE SERVICE BUS NAMESPACE >>'
  queue_name = '<< NAME OF THE QUEUE >>'
  client = ServiceBusClient.from_connection_string(
      connection_str, uamqp_transport=True
  )
  ```

  Note: The `message` attribute on `ServiceBusMessage`/`ServiceBusMessageBatch`/`ServiceBusReceivedMessage`, which previously exposed the `uamqp.Message`, has been deprecated.
   The "Legacy" objects returned by `message` attribute have been introduced to help facilitate the transition.

  To enable the `uamqp` logger to collect traces from the underlying uAMQP library:
  ```python
  import logging

  uamqp_logger = logging.getLogger('uamqp')
  uamqp_logger.setLevel(logging.DEBUG)
  uamqp_logger.addHandler(handler)

  ...

  from azure.servicebus import ServiceBusClient

  client = ServiceBusClient(..., logging_enable=True)
  ```

  There may be cases where you consider the `uamqp` logging to be too verbose. To suppress unnecessary logging, add the following snippet to the top of your code:
  ```python
  import logging


  uamqp_logger = logging.getLogger('uamqp')
  uamqp_logger.setLevel(logging.ERROR)


  uamqp_connection_logger = logging.getLogger('uamqp.connection')
  uamqp_connection_logger.setLevel(logging.ERROR)
  ```



  `azure-servicebus` depends on the [uAMQP](https://pypi.org/project/uamqp/) for the AMQP protocol implementation.
  uAMQP wheels are provided for most major operating systems and will be installed automatically when installing `azure-servicebus`.
  If [uAMQP](https://pypi.org/project/uamqp/) is intended to be used as the underlying AMQP protocol implementation for `azure-servicebus`,
  uAMQP wheels can be found for most major operating systems.

  If you're running on a platform for which uAMQP wheels are not provided, please follow
  If you intend to use `uAMQP` and you're running on a platform for which uAMQP wheels are not provided, please follow
   the [uAMQP Installation](https://github.com/Azure/azure-uamqp-python#installation) guidance to install from source.



  This project welcomes contributions and suggestions.  Most contributions require you to agree to a
  Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
  the rights to use your contribution. For details, visit https://cla.microsoft.com.

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
  a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
  provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
  For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
  contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

  <!-- LINKS -->
  [azure_cli]: https://docs.microsoft.com/cli/azure
  [api_docs]: https://docs.microsoft.com/python/api/overview/azure/servicebus-readme
  [product_docs]: https://docs.microsoft.com/azure/service-bus-messaging/
  [azure_portal]: https://portal.azure.com
  [azure_sub]: https://azure.microsoft.com/free/
  [cloud_shell]: https://docs.microsoft.com/azure/cloud-shell/overview
  [cloud_shell_bash]: https://shell.azure.com/bash
  [pip]: https://pypi.org/project/pip/
  [pypi]: https://pypi.org/project/azure-servicebus/
  [python]: https://www.python.org/downloads/
  [venv]: https://docs.python.org/3/library/venv.html
  [virtualenv]: https://virtualenv.pypa.io
  [service_bus_namespace]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-create-namespace-portal
  [service_bus_overview]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-messaging-overview
  [queue_status_codes]: https://docs.microsoft.com/rest/api/servicebus/create-queue#response-codes
  [service_bus_docs]: https://docs.microsoft.com/azure/service-bus/
  [service_bus_mgmt_docs]: https://docs.microsoft.com/python/api/azure-mgmt-servicebus/?view=azure-python
  [queue_concept]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-messaging-overview#queues
  [topic_concept]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-messaging-overview#topics
  [subscription_concept]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-queues-topics-subscriptions#topics-and-subscriptions
  [azure_namespace_creation]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-create-namespace-portal
  [servicebus_management_repository]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-mgmt-servicebus
  [get_servicebus_conn_str]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-create-namespace-portal#get-the-connection-string
  [servicebus_aad_authentication]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-authentication-and-authorization
  [token_credential_interface]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core/azure/core/credentials.py
  [pypi_azure_identity]: https://pypi.org/project/azure-identity/
  [message_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html#azure.servicebus.ServiceBusMessage
  [receiver_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html#azure.servicebus.ServiceBusReceiver
  [sender_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html#azure.servicebus.ServiceBusSender
  [client_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html#azure.servicebus.ServiceBusClient
  [send_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=send_messages#azure.servicebus.ServiceBusSender.send_messages
  [receive_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=receive_messages#azure.servicebus.ServiceBusReceiver.receive_messages
  [streaming_receive_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=next#azure.servicebus.ServiceBusReceiver.next
  [session_receive_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=session_id#azure.servicebus.ServiceBusSessionReceiver.receive_messages
  [session_send_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=session_id#azure.servicebus.ServiceBusMessage.session_id
  [complete_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=complete_message#azure.servicebus.ServiceBusReceiver.complete_message
  [abandon_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=abandon_message#azure.servicebus.ServiceBusReceiver.abandon_message
  [defer_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=defer_message#azure.servicebus.ServiceBusReceiver.defer_message
  [deadletter_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=dead_letter_message#azure.servicebus.ServiceBusReceiver.dead_letter_message
  [autolockrenew_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html#azure.servicebus.AutoLockRenewer
  [exception_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html#module-azure.servicebus.exceptions
  [subscription_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.aio.html?highlight=subscription#azure.servicebus.aio.ServiceBusClient.get_subscription_receiver
  [topic_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-servicebus/latest/azure.servicebus.html?highlight=topic#azure.servicebus.ServiceBusClient.get_topic_sender
  [sample_authenticate_client_connstr]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/servicebus/azure-servicebus/samples/sync_samples/authenticate_client_connstr.py
  [sample_authenticate_client_aad]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/servicebus/azure-servicebus/samples/sync_samples/client_identity_authentication.py
  [migration_guide]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/migration_guide.md








   - Fixed a bug where token refreshes were not happening on long running operations ([35717](https://github.com/Azure/azure-sdk-for-python/issues/35717))
   - Fixed a bug where using TokenCredential to create a subscription with forwarding caused a `ResourceNotFoundError` ([36545](https://github.com/Azure/azure-sdk-for-python/pull/36545))
   - Fixed a bug where messages received on one receiver could not be settled on another receiver over mgmt link ([35304](https://github.com/Azure/azure-sdk-for-python/issues/35304))
   - Addressed a bug where excess Link Credits were being allocated when large messages were being received ([34270](https://github.com/Azure/azure-sdk-for-python/issues/34270))





  - Fixed a bug where WebsocketConnectionClosedException was not being caught when receiving with AmqpOverWebsocket ([34859](https://github.com/Azure/azure-sdk-for-python/pull/34859))
  - Fixed incorrect dependency on typing-extensions ([34869](https://github.com/Azure/azure-sdk-for-python/issues/34869), thanks @YaroBear).





  - Fixed a bug where the client was not retrying when a connection drop happened ([34786](https://github.com/Azure/azure-sdk-for-python/pull/34786))
  - Fixed a bug where the client would not handle a role instance swap on the service correctly ([34820](https://github.com/Azure/azure-sdk-for-python/pull/34820))



  - Updated the logging to more accurately represent when frames are being sent to prevent a client-side idle timeout ([#34793](https://github.com/Azure/azure-sdk-for-python/pull/34793)).





  - Updated `max_wait_time` on the ServiceBusReceiver constructor allowing users to change the default server timeout of 65 seconds when accepting a session on a Session-Enabled/Queues/Topics if NEXT_AVAILABLE_SESSION is used.



  - Updated minimum `azure-core` version to 1.28.0.
  - Updated Pure Python AMQP network trace logging to replace `None` values in AMQP connection info with empty strings as per the OpenTelemetry specification ([#32190](https://github.com/Azure/azure-sdk-for-python/issues/32190)).
  - Updated Pure Python AMQP network trace logging error log on connection close to warning (PR #34504, thanks @RichardOberdieck).





  - Fixed a bug where a two character count session id was being incorrectly parsed by azure amqp.





  - Fixed a bug where `prefetch_count` was not being passed through correctly and caused messages to not be received as expected when in `RECEIVE_AND_DELETE` mode ([#31712](https://github.com/Azure/azure-sdk-for-python/issues/31712), [#31711](https://github.com/Azure/azure-sdk-for-python/issues/31711)).





  - Fixed the error `NoneType object has no attribute 'settle_messages'` which was raised when a connection was dropped due to a blocked process ([#30514](https://github.com/Azure/azure-sdk-for-python/issues/30514))



  - The `__contains__` method was added to `azure.servicebus` for the following (PR #30846, thanks @pamelafox).
    - `ServiceBusConnectionStringProperties`
    - `amqp.AmqpMessageHeader`
    - `amqp.AmqpMessageProperties`
    - `management.AccessRights`
    - `management.NamespaceProperties`
    - `management.QueueProperties`
    - `management.TopicProperties`
    - `management.SubscriptionProperties`
    - `management.RuleProperties`





  - Fixed the error `end frame received on invalid channel` which was raised when a disconnect was sent by the service ([#30860](https://github.com/Azure/azure-sdk-for-python/pull/30860))
  - Fixed the error `link already closed` which was raised when the client was closing and disconnecting from the service ([#30836](https://github.com/Azure/azure-sdk-for-python/pull/30836))



  - The error raised when attempting to complete a message with an expired lock received from a non-sessionful entity has been updated to the more fine-grained `MessageLockLostError` from the superclass `ServiceBusError`.





  - A new float keyword argument `socket_timeout` has been added to `get_queue_sender`, `get_queue_receiver`, `get_topic_sender`, and `get_subscription_receiver` on the sync and async `ServiceBusClient`.



  - Fixed a bug where sending large messages failed on socket write timeout ([#30425](https://github.com/Azure/azure-sdk-for-python/issues/30425)).
  - Fixed a bug where settling large messages failed due to  `delivery_id` being `None`.



  - Tracing updates:
    - Span links on receive/send spans now fall back to using `Diagnostic-Id` if the `traceparent` message application property is not found.
    - Span links will now still be created for receive/send spans even if no context propagation headers are found in message application properties.
    - The `component` attribute was removed from all spans.



  Version 7.10.0 is our first stable release of the Azure Service Bus client library based on a pure Python implemented AMQP stack.



  - A new boolean keyword argument `uamqp_transport` has been added to sync and async `ServiceBusClient` constructors which indicates whether to use the `uamqp` library or the default pure Python AMQP library as the underlying transport.



  - Added the following as dependencies to be used for operations over websocket:
    - `websocket-client` for sync
    - `aiohttp` for async
  - Removed uAMQP from required dependencies and added it as an optional dependency for use with the `uamqp_transport` keyword.



  - Fixed a bug where sync and async `ServiceBusAdministrationClient` expected `credential` with `get_token` method returning `AccessToken.token` of type `bytes` and not `str`, now matching the documentation.
  - Fixed a bug where `raw_amqp_message.header` and `message.header` properties on `ServiceReceivedBusMessage` were returned with `durable`, `first_acquirer`, and `priority` properties set by default, rather than the values returned by the service.
  - Fixed a bug where `ServiceBusReceivedMessage` was not picklable (Issue #27947).



  - The `message` attribute on `ServiceBus`/`ServiceBusMessageBatch`/`ServiceBusReceivedMessage`, which previously exposed the `uamqp.Message`/`uamqp.BatchMessage`, has been deprecated.
    - `LegacyMessage`/`LegacyBatchMessage` objects returned by the `message` attribute on `ServiceBus`/`ServiceBusMessageBatch` have been introduced to help facilitate the transition.
  - Removed uAMQP from required dependencies.
  - Adding `uamqp >= 1.6.3` as an optional dependency for use with the `uamqp_transport` keyword.
   - Updated tracing ([#29995](https://github.com/Azure/azure-sdk-for-python/pull/29995)):
     - Additional attributes added to existing spans:
       - `messaging.system` - messaging system (i.e., `servicebus`)
       - `messaging.operation` - type of operation (i.e., `publish`, `receive`, or `settle`)
       - `messaging.batch.message_count` - number of messages sent or received (if more than one)
     - A span will now be created upon calls to the service that settle messages.
       - The span name will contain the settlement operation (e.g., `ServiceBus.complete`)
       - The span will contain `az.namespace`, `messaging.destination.name`, `net.peer.name`, `messaging.system`, and `messaging.operation` attributes.
     - All `send` spans now contain links to `message` spans. Now, `message` spans will no longer contain a link to the `send` span.





  - A new boolean keyword argument `uamqp_transport` has been added to sync and async `ServiceBusClient` constructors which indicates whether to use the `uamqp` library or the default pure Python AMQP library as the underlying transport.



  - Fixed a bug where sync and async `ServiceBusAdministrationClient` expected `credential` with `get_token` method returning `AccessToken.token` of type `bytes` and not `str`, now matching the documentation.
  - Fixed a bug where `raw_amqp_message.header` and `message.header` properties on `ServiceReceivedBusMessage` were returned with `durable`, `first_acquirer`, and `priority` properties set by default, rather than the values returned by the service.



  - The `message` attribute on `ServiceBus`/`ServiceBusMessageBatch`/`ServiceBusReceivedMessage`, which previously exposed the `uamqp.Message`/`uamqp.BatchMessage`, has been deprecated.
    - `LegacyMessage`/`LegacyBatchMessage` objects returned by the `message` attribute on `ServiceBus`/`ServiceBusMessageBatch` have been introduced to help facilitate the transition.
  - Removed uAMQP from required dependencies.
  - Adding `uamqp >= 1.6.3` as an optional dependency for use with the `uamqp_transport` keyword.





  - Client side validation of input is now disabled by default for the sync and async `ServiceBusAdministrationClient`. This means there will be no `msrest.exceptions.ValidationError` raised by the `ServiceBusAdministrationClient` in the case of malformed input. An `azure.core.exceptions.HttpResponseError` may now be raised if the server refuses the request.



  - Fixed a bug where enum members in `azure.servicebus.management` were not following uppercase convention.



  - All pure Python AMQP stack related changes have been removed and will be added back in the next version.
  - Updated minimum `azure-core` version to 1.24.0.
  - Removed `msrest` dependency.
  - Removed `azure-common` dependency.





  - Iterator receiving from Service Bus entities has been added back in.





  - Fixed a bug where asynchronous method to add distributed tracing attributes was not being awaited (Issue #28738).





  - Fixed a bug that would cause an exception when `None` was sent to `set_state` instead of clearing session state (Issue #27582).



  - Updated uAMQP dependency to 1.6.3.
    - Added support for Python 3.11.



  Version 7.9.0a1 is our first efforts to build an Azure Service Bus client library based on a pure Python implemented AMQP stack.



  - The following features have been temporarily pulled out which will be added back in future previews as we work towards a stable release:
    - Iterator receiving from Service Bus entities.



  - uAMQP dependency is removed.



  This version and all future versions will require Python 3.7+. Python 3.6 is no longer supported.



  - Fixed bug on async `ServiceBusClient` where `custom_endpoint_address` and `connection_verify` kwargs were not being passed through correctly. (Issue #26015)



  This version will be the last version to officially support Python 3.6, future versions will require Python 3.7+.



  - In `ServiceBusClient`, `get_queue_receiver`, `get_subscription_receiver`, `get_queue_sender`, and `get_topic_sender` now accept
  an optional `client_identifier` argument which allows for specifying a custom identifier for the respective sender or receiver. It can
  be useful during debugging as Service Bus associates the id with errors and helps with easier correlation.
  - `ServiceBusReceiver` and `ServiceBusSender` have an added property `client_identifier` which returns the `client_identifier` for the current instance.





  - Fixed bug to make AMQP exceptions retryable by default, if condition is not non-retryable, to ensure that InternalServerErrors are retried.



  - The `ServiceBusClient` constructor now accepts optional `custom_endpoint_address` argument
  which allows for specifying a custom endpoint to use when communicating with the Service Bus service,
  and is useful when your network does not allow communicating to the standard Service Bus endpoint.
  - The `ServiceBusClient`constructor now accepts optional `connection_verify` argument
  which allows for specifying the path to the custom CA_BUNDLE file of the SSL certificate which is used to authenticate
  the identity of the connection endpoint.





  - Improved receiving by releasing messages from internal buffer when the `prefetch_count` of `ServiceBusReceiver`  is set 0 and there is no active receive call, this helps avoid receiving expired messages and incrementing delivery count of a message.





  - Introduce `ServiceBusMessageState` enum that can assume the values of `active`, `scheduled` or `deferred`.
  - Add `state` property in `ServiceBusReceivedMessage`.



  This version and all future versions will require Python 3.6+. Python 2.7 is no longer supported.



  - Added support for fixed (linear) retry backoff:
    - Sync/async `ServiceBusClient` constructors and `from_connection_string` take `retry_mode` as a keyword argument.
  - Added new enum class `ServiceBusSessionFilter`, which is the type of existing `NEXT_AVAILABLE_SESSION` value.



  - Fixed bug that when setting `ServiceBusMessage.time_to_live` with value being `datetime.timedelta`, `total_seconds` should be respected (PR #21869, thanks @jyggen).



  - Improved token refresh timing to prevent potentially blocking main flow when the token is about to get expired soon.
  - Updated uAMQP dependency to 1.5.1.





  - GA the support to create and update queues and topics of large message size to `ServiceBusAdministrationClient`. This feature is only available for Service Bus of Premium Tier.
    - Methods`create_queue`, `create_topic`, `update_queue`, `update_topic` on `ServiceBusAdministrationClient` now take a new keyword argument `max_message_size_in_kilobytes`.
    - `QueueProperties` and `TopicProperties` now have a new instance variable `max_message_size_in_kilobytes`.
  - The constructor of`ServiceBusAdministrationClient` as well as `ServiceBusAdministrationClient.from_connection_string` now take keyword argument `api_version` to configure the Service Bus API version. Supported service versions are "2021-05" and "2017-04".
  - Added new enum class `azure.servicebus.management.ApiVersion` to represent the supported Service Bus API versions.



  - Fixed bug that `ServiceBusReceiver` can not connect to sessionful entity with session id being empty string.
  - Fixed bug that `ServiceBusMessage.partition_key` can not parse empty string properly.





  - Added support to create and update queues and topics of large message size to `ServiceBusAdministrationClient`. This feature is only available for Service Bus of Premium Tier.
    - Methods`create_queue`, `create_topic`, `update_queue`, `update_topic` on `ServiceBusAdministrationClient` now take a new keyword argument `max_message_size_in_kilobytes`.
    - `QueueProperties` and `TopicProperties` now have a new instance variable `max_message_size_in_kilobytes`.





  - Updated uAMQP dependency to 1.4.3.
    - Added support for Python 3.10.
    - Fixed memory leak in win32 socketio and tlsio (issue #19777).
    - Fixed memory leak in the process of converting AMQPValue into string (issue #19777).





  - Improved memory usage of `ServiceBusClient` to automatically discard spawned `ServiceBusSender` or `ServiceBusReceiver` from its handler set when no strong reference to the sender or receiver exists anymore.
  - Reduced CPU load of `azure.servicebus.AutoLockRenewer` during lock renewal.





  - Fixed a bug that `azure.servicebus.aio.AutoLockRenewer` crashes on disposal if no messages have been registered (#19642).
  - Fixed a bug that `azure.servicebus.AutoLockRenewer` only supports auto lock renewal for `max_workers` amount of messages/sessions at a time (#19362).





  - Fixed a bug that when setting `ServiceBusMessage.partition_key`, input value should be not validated against `session_id` of None (PR #19233, thanks @bishnu-shb).
  - Fixed a bug that setting `ServiceBusMessage.time_to_live` causes OverflowError error on Ubuntu 20.04.
  - Fixed a bug that `AmqpAnnotatedProperties.creation_time` and `AmqpAnnotatedProperties.absolute_expiry_time` should be calculated in the unit of milliseconds instead of seconds.
  - Updated uAMQP dependency to 1.4.1.
    - Fixed a bug that attributes creation_time, absolute_expiry_time and group_sequence on MessageProperties should be compatible with integer types on Python 2.7.



  **New Features**

  - Support for sending AMQP annotated message which allows full access to the AMQP message fields is now GA.
    - Introduced new namespace `azure.servicebus.amqp`.
    - Introduced new classes `azure.servicebus.amqp.AmqpMessageHeader` and `azure.servicebus.amqp.AmqpMessageProperties` for accessing amqp header and properties.

  **Breaking Changes from 7.2.0b1**
    - Renamed and moved `azure.servicebus.AMQPAnnotatedMessage` to `azure.servicebus.amqp.AmqpAnnotatedMessage`.
    - Renamed and moved `azure.servicebus.AMQPMessageBodyType` to `azure.servicebus.amqp.AmqpMessageBodyType`.
    - `AmqpAnnotatedMessage.header` returns `azure.servicebus.amqp.AmqpMessageHeader` instead of `uamqp.message.MessageHeader`.
    - `AmqpAnnotatedMessage.properties` returns `azure.servicebus.amqp.AmqpMessageProperties` instead of `uamqp.message.MessageProperties`.
    - `raw_amqp_message` on `ServiceBusMessage` and `ServiceBusReceivedMessage` is now a read-only property instead of an instance variable.

  **Bug Fixes**

  * Fixed a bug that `ServiceBusReceiver` iterator stops iteration after recovery from connection error (#18795).



  The preview features related to AMQPAnnotatedMessage introduced in 7.2.0b1 are not included in this version.

  **New Features**

  * Added support for using `azure.core.credentials.AzureNamedKeyCredential` as credential for authenticating the clients.
  * Support for using `azure.core.credentials.AzureSasCredential` as credential for authenticating the clients is now GA.
  * `ServiceBusAdministrationClient.update_*` methods now accept keyword arguments to override the properties specified in the model instance.

  **Bug Fixes**

  * Fixed a bug where `update_queue` and `update_subscription` methods were mutating the properties `forward_to` and `forward_dead_lettered_messages_to` of the model instance when those properties are entities instead of full paths.
  * Improved the `repr` on `ServiceBusMessage` and `ServiceBusReceivedMessage` to show more meaningful text.
  * Updated uAMQP dependency to 1.4.0.
    - Fixed memory leaks in the process of link attach where source and target cython objects are not properly deallocated (#15747).
    - Improved management operation callback not to parse description value of non AMQP_TYPE_STRING type as string (#18361).

  **Notes**

  * Updated azure-core dependency to 1.14.0.



  **New Features**

  * Added support for using `azure.core.credentials.AzureSasCredential` as credential for authenticating the clients.
  * Added support for sending AMQP annotated message which allows full access to the AMQP message fields.
    -`azure.servicebus.AMQPAnnotatedMessage` is now made public and could be instantiated for sending.
  * Added new enum class `azure.servicebus.AMQPMessageBodyType` to represent the body type of the message message which includes:
    - `DATA`: The body of message consists of one or more data sections and each section contains opaque binary data.
    - `SEQUENCE`: The body of message consists of one or more sequence sections and each section contains an arbitrary number of structured data elements.
    - `VALUE`: The body of message consists of one amqp-value section and the section contains a single AMQP value.
  * Added new property `body_type` on `azure.servicebus.ServiceBusMessage` and `azure.servicebus.ReceivedMessage` which returns `azure.servicebus.AMQPMessageBodyType`.



  This version and all future versions will require Python 2.7 or Python 3.6+, Python 3.5 is no longer supported.

  **New Features**

  * Updated `forward_to` and `forward_dead_lettered_messages_to` parameters in `create_queue`, `update_queue`, `create_subscription`, and `update_subscription` methods on sync and async `ServiceBusAdministrationClient` to accept entities as well, rather than only full paths. In the case that an entity is passed in, it is assumed that the entity exists within the same namespace used for constructing the `ServiceBusAdministrationClient`.

  **Bug Fixes**

  * Updated uAMQP dependency to 1.3.0.
    - Fixed bug that sending message of large size triggering segmentation fault when the underlying socket connection is lost (#13739, #14543).
    - Fixed bug in link flow control where link credit and delivery count should be calculated based on per message instead of per transfer frame (#16934).



  This version will be the last version to officially support Python 3.5, future versions will require Python 2.7 or Python 3.6+.

  **New Features**

  * Updated the following methods so that lists and single instances of Mapping representations are accepted for corresponding strongly-typed object arguments (PR #14807, thanks @bradleydamato):
    - `update_queue`, `update_topic`, `update_subscription`, and `update_rule` on `ServiceBusAdministrationClient` accept Mapping representations of `QueueProperties`, `TopicProperties`, `SubscriptionProperties`, and `RuleProperties`, respectively.
    - `send_messages` and `schedule_messages` on both sync and async versions of `ServiceBusSender` accept a list of or single instance of Mapping representations of `ServiceBusMessage`.
    - `add_message` on `ServiceBusMessageBatch` now accepts a Mapping representation of `ServiceBusMessage`.

  **BugFixes**

  * Operations failing due to `uamqp.errors.LinkForceDetach` caused by no activity on the connection for 10 minutes will now be retried internally except for the session receiver case.
  * `uamqp.errors.AMQPConnectionError` errors with condition code `amqp:unknown-error` are now categorized into `ServiceBusConnectionError` instead of the general `ServiceBusError`.
  * The `update_*` methods on `ServiceBusManagementClient` will now raise a `TypeError` rather than an `AttributeError` in the case of unsupported input type.



  **BugFixes**

  * `forward_to` and `forward_dead_lettered_messages_to` will no longer cause authorization errors when used in `ServiceBusAdministrationClient` for queues and subscriptions (#15543).
  * Updated uAMQP dependency to 1.2.13.
    - Fixed bug that macOS was unable to detect network error (#15473).
    - Fixed bug that `uamqp.ReceiveClient` and `uamqp.ReceiveClientAsync` receive messages during connection establishment (#15555).
    - Fixed bug where connection establishment on macOS with Clang 12 triggering unrecognized selector exception (#15567).
    - Fixed bug in accessing message properties triggering segmentation fault when the underlying C bytes are NULL (#15568).



  > **Note:** This is the GA release of the `azure-servicebus` package, rolling out the official API surface area constructed over the prior preview releases.  Users migrating from `v0.50` are advised to view the [migration guide](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/migration_guide.md).

  **New Features**

  * `sub_queue` and `receive_mode` may now be passed in as a valid string (as defined by their respective enum type) as well as their enum form when constructing `ServiceBusReceiver`.
  * Added support for Distributed Tracing of send, receive, and schedule scenarios.

  **Breaking Changes**

  * `ServiceBusSender` and `ServiceBusReceiver` are no longer reusable and will raise `ValueError` when trying to operate on a closed handler.
  * Rename `ReceiveMode` to `ServiceBusReceiveMode` and `SubQueue` to `ServiceBusSubQueue`, and convert their enum values from ints to human-readable strings.
  * Rename enum values `DeadLetter` to `DEAD_LETTER`, `TransferDeadLetter` to `TRANSFER_DEAD_LETTER`, `PeekLock` to `PEEK_LOCK` and `ReceiveAndDelete` to `RECEIVE_AND_DELETE` to conform to sdk guidelines going forward.
  * `send_messages`, `schedule_messages`, `cancel_scheduled_messages` and `receive_deferred_messages` now performs a no-op rather than raising a `ValueError` if provided an empty list of messages or an empty batch.
  * `ServiceBusMessage.amqp_annotated_message` has been renamed to `ServiceBusMessage.raw_amqp_message` to normalize with other SDKs.
  * Redesigned error hierarchy based on the service-defined error condition:
    - `MessageAlreadySettled` now inherits from `ValueError` instead of `ServiceBusMessageError` as it's a client-side validation.
    - Removed `NoActiveSession` which is now replaced by `OperationTimeoutError` as the client times out when trying to connect to any available session.
    - Removed `ServiceBusMessageError` as error condition based exceptions provide comprehensive error information.
    - Removed `MessageSettleFailed` as error condition based exceptions provide comprehensive error information.
    - Removed `MessageSendFailed` as error condition based exceptions provide comprehensive error information.
    - Renamed `MessageContentTooLarge` to `MessageSizeExceededError` to be consistent with the term defined by the service.
    - Renamed `MessageLockExpired` to `MessageLockLostError` to be consistent with the term defined by the service.
    - Renamed `SessionLockExpired` to `SessionLockLostError` to be consistent with the term defined by the service.
    - Introduced `MessageNotFoundError` which would be raised when the requested message was not found.
    - Introduced `MessagingEntityNotFoundError` which would be raised when a Service Bus resource cannot be found by the Service Bus service.
    - Introduced `MessagingEntityDisabledError` which would be raised when the Messaging Entity is disabled.
    - Introduced `MessagingEntityAlreadyExistsError` which would be raised when an entity with the same name exists under the same namespace.
    - Introduced `ServiceBusQuotaExceededError` which would be raised when a Service Bus resource has been exceeded while interacting with the Azure Service Bus service.
    - Introduced `ServiceBusServerBusyError` which would be raised when the Azure Service Bus service reports that it is busy in response to a client request to perform an operation.
    - Introduced `ServiceBusCommunicationError` which would be raised when there was a general communications error encountered when interacting with the Azure Service Bus service.
    - Introduced `SessionCannotBeLockedError` which would be raised when the requested session cannot be locked.
  * Introduced new client side validation on certain use cases:
    - `ServiceBusMessage` will now raise a `TypeError` when provided an invalid body type.  Valid bodies are strings, bytes, and None.  Lists are no longer accepted, as they simply concatenated the contents prior.
    - An improper `receive_mode` value will now raise `ValueError` instead of `TypeError` in line with supporting extensible enums.
    - Setting `ServiceBusMessage.partition_key` to a value different than `session_id` on the message instance now raises `ValueError`.
    - `ServiceBusClient.get_queue/topic_sender` and `ServiceBusClient.get_queue/subscription_receiver` will now
  raise `ValueError` if the `queue_name` or `topic_name` does not match the `EntityPath` in the connection string used to construct the `ServiceBusClient`.
    - Settling a message that has been peeked will raise `ValueError`.
    - Settling a message or renewing a lock on a message received in `RECEIVE_AND_DELETE` receive mode will raise `ValueError`.
    - Setting `session_id`, `reply_to_session_id`, `message_id` and `partition_key` on `ServiceBusMessage` longer than 128 characters will raise `ValueError`.
  * `ServiceBusReceiver.get_streaming_message_iter` has been made internal for the time being to assess use patterns before committing to back-compatibility; messages may still be iterated over in equivalent fashion by iterating on the receiver itself.

  **BugFixes**

  * `ServiceBusAdministrationClient.create_rule` by default now creates a `TrueRuleFilter` rule.
  * FQDNs and Connection strings are now supported even with strippable whitespace or protocol headers (e.g. 'sb://').
  * Using parameter `auto_lock_renewer` on a sessionful receiver alongside `ReceiveMode.ReceiveAndDelete` will no longer fail during receipt due to failure to register the message with the renewer.



  **New Features**

  * Added support for `timeout` parameter on the following operations:
    - `ServiceBusSender`: `send_messages`, `schedule_messages` and `cancel_scheduled_messages`
    - `ServiceBusReceiver`: `receive_deferred_messages`, `peek_messages` and `renew_message_lock`
    - `ServiceBusSession`: `get_state`, `set_state` and `renew_lock`
  * `azure.servicebus.exceptions.ServiceBusError` now inherits from `azure.core.exceptions.AzureError`.
  * Added a `parse_connection_string` method which parses a connection string into a properties bag containing its component parts
  * Add support for `auto_lock_renewer` parameter on `get_queue_receiver` and `get_subscription_receiver` calls to allow auto-registration of messages and sessions for auto-renewal.

  **Breaking Changes**

  * Renamed `AutoLockRenew` to `AutoLockRenewer`.
  * Removed class `ServiceBusSessionReceiver` which is now unified within class `ServiceBusReceiver`.
    - Removed methods `ServiceBusClient.get_queue_session_receiver` and `ServiceBusClient.get_subscription_session_receiver`.
    - `ServiceBusClient.get_queue_receiver` and `ServiceBusClient.get_subscription_receiver` now take keyword parameter `session_id` which must be set when getting a receiver for the sessionful entity.
  * The parameter `inner_exception` that `ServiceBusError.__init__` takes is now renamed to `error`.
  * Renamed `azure.servicebus.exceptions.MessageError` to `azure.servicebus.exceptions.ServiceBusMessageError`
  * Removed error `azure.servicebus.exceptions.ServiceBusResourceNotFound` as `azure.core.exceptions.ResourceNotFoundError` is now raised when a Service Bus
  resource does not exist when using the `ServiceBusAdministrationClient`.
  * Renamed `Message` to `ServiceBusMessage`.
  * Renamed `ReceivedMessage` to `ServiceBusReceivedMessage`.
  * Renamed `BatchMessage` to `ServiceBusMessageBatch`.
    - Renamed method `add` to `add_message` on the class.
  * Removed class `PeekedMessage`.
  * Removed class `ReceivedMessage` under module `azure.servicebus.aio`.
  * Renamed `ServiceBusSender.create_batch` to `ServiceBusSender.create_message_batch`.
  * Exceptions `MessageSendFailed`, `MessageSettleFailed` and `MessageLockExpired`
   now inherit from `azure.servicebus.exceptions.ServiceBusMessageError`.
  * `get_state` in `ServiceBusSession` now returns `bytes` instead of a `string`.
  * `ServiceBusReceiver.receive_messages/get_streaming_message_iter` and
   `ServiceBusClient.get_<queue/subscription>_receiver` now raises ValueError if the given `max_wait_time` is less than or equal to 0.
  * Message settlement methods are moved from `ServiceBusMessage` to `ServiceBusReceiver`:
    - Use `ServiceBusReceiver.complete_message` instead of `ServiceBusReceivedMessage.complete` to complete a message.
    - Use `ServiceBusReceiver.abandon_message` instead of `ServiceBusReceivedMessage.abandon` to abandon a message.
    - Use `ServiceBusReceiver.defer_message` instead of `ServiceBusReceivedMessage.defer` to defer a message.
    - Use `ServiceBusReceiver.dead_letter_message` instead of `ServiceBusReceivedMessage.dead_letter` to dead letter a message.
  * Message settlement methods (`complete_message`, `abandon_message`, `defer_message` and `dead_letter_message`)
  and methods that use amqp management link for request like `schedule_messages`, `received_deferred_messages`, etc.
  now raise more concrete exception other than `MessageSettleFailed` and `ServiceBusError`.
  * Message `renew_lock` method is moved from `ServiceBusMessage` to `ServiceBusReceiver`:
    - Changed `ServiceBusReceivedMessage.renew_lock` to `ServiceBusReceiver.renew_message_lock`
  * `AutoLockRenewer.register` now takes `ServiceBusReceiver` as a positional parameter.
  * Removed `encoding` support from `ServiceBusMessage`.
  * `ServiceBusMessage.amqp_message` has been renamed to `ServiceBusMessage.amqp_annotated_message` for cross-sdk consistency.
  * All `name` parameters in `ServiceBusAdministrationClient` are now precisely specified ala `queue_name` or `rule_name`
  * `ServiceBusMessage.via_partition_key` is no longer exposed, this is pending a full implementation of transactions as it has no external use. If needed, the underlying value can still be accessed in `ServiceBusMessage.amqp_annotated_message.annotations`.
  * `ServiceBusMessage.properties` has been renamed to `ServiceBusMessage.application_properties` for consistency with service verbiage.
  * Sub-client (`ServiceBusSender` and `ServiceBusReceiver`) `from_connection_string` initializers have been made internal until needed. Clients should be initialized from root `ServiceBusClient`.
  * `ServiceBusMessage.label` has been renamed to `ServiceBusMessage.subject`.
  * `ServiceBusMessage.amqp_annotated_message` has had its type renamed from `AMQPMessage` to `AMQPAnnotatedMessage`
  * `AutoLockRenewer` `timeout` parameter is renamed to `max_lock_renew_duration`
  * Attempting to autorenew a non-renewable message, such as one received in `ReceiveAndDelete` mode, or configure auto-autorenewal on a `ReceiveAndDelete` receiver, will raise a `ValueError`.
  * The default value of parameter `max_message_count` on `ServiceBusReceiver.receive_messages` is now `1` instead of `None` and will raise ValueError if the given value is less than or equal to 0.

  **BugFixes**

  * Updated uAMQP dependency to 1.2.12.
    - Added support for Python 3.9.
    - Fixed bug where amqp message `footer` and `delivery_annotation` were not encoded into the outgoing payload.



  **Breaking Changes**

  * Passing any type other than `ReceiveMode` as parameter `receive_mode` now throws a `TypeError` instead of `AttributeError`.
  * Administration Client calls now take only entity names, not `<Entity>Descriptions` as well to reduce ambiguity in which entity was being acted on. TypeError will now be thrown on improper parameter types (non-string).
  * `AMQPMessage` (`Message.amqp_message`) properties are now read-only, changes of these properties would not be reflected in the underlying message.  This may be subject to change before GA.



  **New Features**

  * `renew_lock()` now returns the UTC datetime that the lock is set to expire at.
  * `receive_deferred_messages()` can now take a single sequence number as well as a list of sequence numbers.
  * Messages can now be sent twice in succession.
  * Connection strings used with `from_connection_string` methods now support using the `SharedAccessSignature` key in leiu of `sharedaccesskey` and `sharedaccesskeyname`, taking the string of the properly constructed token as value.
  * Internal AMQP message properties (header, footer, annotations, properties, etc) are now exposed via `Message.amqp_message`

  **Breaking Changes**

  * Renamed `prefetch` to `prefetch_count`.
  * Renamed `ReceiveSettleMode` enum to `ReceiveMode`, and respectively the `mode` parameter to `receive_mode`.
  * `retry_total`, `retry_backoff_factor` and `retry_backoff_max` are now defined at the `ServiceBusClient` level and inherited by senders and receivers created from it.
  * No longer export `NEXT_AVAILABLE` in `azure.servicebus` module.  A null `session_id` will suffice.
  * Renamed parameter `message_count` to `max_message_count` as fewer messages may be present for method `peek_messages()` and `receive_messages()`.
  * Renamed `PeekMessage` to `PeekedMessage`.
  * Renamed `get_session_state()` and `set_session_state()` to `get_state()` and `set_state()` accordingly.
  * Renamed parameter `description` to `error_description` for method `dead_letter()`.
  * Renamed properties `created_time` and `modified_time` to `created_at_utc` and `modified_at_utc` within `AuthorizationRule` and `NamespaceProperties`.
  * Removed parameter `requires_preprocessing` from `SqlRuleFilter` and `SqlRuleAction`.
  * Removed property `namespace_type` from `NamespaceProperties`.
  * Rename `ServiceBusManagementClient` to `ServiceBusAdministrationClient`
  * Attempting to call `send_messages` on something not a `Message`, `BatchMessage`, or list of `Message`s, will now throw a `TypeError` instead of `ValueError`
  * Sending a message twice will no longer result in a MessageAlreadySettled exception.
  * `ServiceBusClient.close()` now closes spawned senders and receivers.
  * Attempting to initialize a sender or receiver with a different connection string entity and specified entity (e.g. `queue_name`) will result in an AuthenticationError
  * Remove `is_anonymous_accessible` from management entities.
  * Remove `support_ordering` from `create_queue` and `QueueProperties`
  * Remove `enable_subscription_partitioning` from `create_topic` and `TopicProperties`
  * `get_dead_letter_[queue,subscription]_receiver()` has been removed.  To connect to a dead letter queue, utilize the `sub_queue` parameter of `get_[queue,subscription]_receiver()` provided with a value from the `SubQueue` enum
  * No longer export `ServiceBusSharedKeyCredential`
  * Rename `entity_availability_status` to `availability_status`



  **New Features**

  * Added new properties to Message, PeekMessage and ReceivedMessage: `content_type`, `correlation_id`, `label`,
  `message_id`, `reply_to`, `reply_to_session_id` and `to`. Please refer to the docstring for further information.
  * Added new properties to PeekMessage and ReceivedMessage: `enqueued_sequence_number`, `dead_letter_error_description`,
  `dead_letter_reason`, `dead_letter_source`, `delivery_count` and `expires_at_utc`. Please refer to the docstring for further information.
  * Added support for sending received messages via `ServiceBusSender.send_messages`.
  * Added `on_lock_renew_failure` as a parameter to `AutoLockRenew.register`, taking a callback for when the lock is lost non-intentially (e.g. not via settling, shutdown, or autolockrenew duration completion).
  * Added new supported value types int, float, datetime and timedelta for `CorrelationFilter.properties`.
  * Added new properties `parameters` and `requires_preprocessing` to `SqlRuleFilter` and `SqlRuleAction`.
  * Added an explicit method to fetch the continuous receiving iterator, `get_streaming_message_iter()` such that `max_wait_time` can be specified as an override.

  **Breaking Changes**

  * Removed/Renamed several properties and instance variables on Message (the changes applied to the inherited Message type PeekMessage and ReceivedMessage).
    - Renamed property `user_properties` to `properties`
        - The original instance variable `properties` which represents the AMQP properties now becomes an internal instance variable `_amqp_properties`.
    - Removed property `enqueue_sequence_number`.
    - Removed property `annotations`.
    - Removed instance variable `header`.
  * Removed several properties and instance variables on PeekMessage and ReceivedMessage.
    - Removed property `partition_id` on both type.
    - Removed property `settled` on both type.
    - Removed instance variable `received_timestamp_utc` on both type.
    - Removed property `settled` on `PeekMessage`.
    - Removed property `expired` on `ReceivedMessage`.
  * `AutoLockRenew.sleep_time` and `AutoLockRenew.renew_period` have been made internal as `_sleep_time` and `_renew_period` respectively, as it is not expected a user will have to interact with them.
  * `AutoLockRenew.shutdown` is now `AutoLockRenew.close` to normalize with other equivalent behaviors.
  * Renamed `QueueDescription`, `TopicDescription`, `SubscriptionDescription` and `RuleDescription` to `QueueProperties`, `TopicProperties`, `SubscriptionProperties`, and `RuleProperties`.
  * Renamed `QueueRuntimeInfo`, `TopicRuntimeInfo`, and `SubscriptionRuntimeInfo` to `QueueRuntimeProperties`, `TopicRuntimeProperties`, and `SubscriptionRuntimeProperties`.
  * Removed param `queue` from `create_queue`, `topic` from `create_topic`, `subscription` from `create_subscription` and `rule` from `create_rule`
   of `ServiceBusManagementClient`. Added param `name` to them and keyword arguments for queue properties, topic properties, subscription properties and rule properties.
  * Removed model class attributes related keyword arguments from `update_queue` and `update_topic` of `ServiceBusManagementClient`. This is to encourage utilizing the model class instance instead as returned from a create_\*, list_\* or get_\* operation to ensure it is properly populated.  Properties may still be modified.
  * Model classes `QueueProperties`, `TopicProperties`, `SubscriptionProperties` and `RuleProperties` require all arguments to be present for creation.  This is to protect against lack of partial updates by requiring all properties to be specified.
  * Renamed `idle_timeout` in `get_<queue/subscription>_receiver()` to `max_wait_time` to normalize with naming elsewhere.
  * Updated uAMQP dependency to 1.2.10 such that the receiver does not shut down when generator times out, and can be received from again.



  **New Features**

  * Added support for management of topics, subscriptions, and rules.
  * `receive_messages()` (formerly `receive()`) now supports receiving a batch of messages (`max_batch_size` > 1) without the need to set `prefetch` parameter during `ServiceBusReceiver` initialization.

  **BugFixes**

  * Fixed bug where sync `AutoLockRenew` does not shutdown itself timely.
  * Fixed bug where async `AutoLockRenew` does not support context manager.

  **Breaking Changes**

  * Renamed `receive()`, `peek()` `schedule()` and `send()` to `receive_messages()`, `peek_messages()`, `schedule_messages()` and `send_messages()` to align with other service bus SDKs.
  * `receive_messages()` (formerly `receive()`) no longer raises a `ValueError` if `max_batch_size` is less than the `prefetch` parameter set during `ServiceBusReceiver` initialization.



  **New Features**

  * Added support for management of queue entities.
      - Use `azure.servicebus.management.ServiceBusManagementClient` (`azure.servicebus.management.aio.ServiceBusManagementClient` for aio) to create, update, delete, list queues and get settings as well as runtime information of queues under a ServiceBus namespace.
  * Added methods `get_queue_deadletter_receiver` and `get_subscription_deadletter_receiver` in `ServiceBusClient` to get a `ServiceBusReceiver` for the dead-letter sub-queue of the target entity.

  **BugFixes**

  * Updated uAMQP dependency to 1.2.8.
      * Fixed bug where reason and description were not being set when dead-lettering messages.



  **New Features**

  * Added method `get_topic_sender` in `ServiceBusClient` to get a `ServiceBusSender` for a topic.
  * Added method `get_subscription_receiver` in `ServiceBusClient` to get a `ServiceBusReceiver` for a subscription under specific topic.
  * Added support for scheduling messages and scheduled message cancellation.
      - Use `ServiceBusSender.schedule(messages, schedule_time_utc)` for scheduling messages.
      - Use `ServiceBusSender.cancel_scheduled_messages(sequence_numbers)` for scheduled messages cancellation.
  * `ServiceBusSender.send()` can now send a list of messages in one call, if they fit into a single batch.  If they do not fit a `ValueError` is thrown.
  * `BatchMessage.add()` and `ServiceBusSender.send()` would raise `MessageContentTooLarge` if the content is over-sized.
  * `ServiceBusReceiver.receive()` raises `ValueError` if its param `max_batch_size` is greater than param `prefetch` of `ServiceBusClient`.
  * Added exception classes `MessageError`, `MessageContentTooLarge`, `ServiceBusAuthenticationError`.
     - `MessageError`: when you send a problematic message, such as an already sent message or an over-sized message.
     - `MessageContentTooLarge`: when you send an over-sized message. A subclass of `ValueError` and `MessageError`.
     - `ServiceBusAuthenticationError`: on failure to be authenticated by the service.
  * Removed exception class `InvalidHandlerState`.

  **BugFixes**

  * Fixed bug where http_proxy and transport_type in ServiceBusClient are not propagated into Sender/Receiver creation properly.
  * Updated uAMQP dependency to 1.2.7.
      * Fixed bug in setting certificate of tlsio on MacOS. #7201
      * Fixed bug that caused segmentation fault in network tracing on MacOS when setting `logging_enable` to `True` in `ServiceBusClient`.

  **Breaking Changes**

  * Session receivers are now created via their own top level functions, e.g. `get_queue_sesison_receiver` and `get_subscription_session_receiver`.  Non session receivers no longer take session_id as a paramter.
  * `ServiceBusSender.send()` no longer takes a timeout parameter, as it should be redundant with retry options provided when creating the client.
  * Exception imports have been removed from module `azure.servicebus`. Import from `azure.servicebus.exceptions` instead.
  * `ServiceBusSender.schedule()` has swapped the ordering of parameters `schedule_time_utc` and `messages` for better consistency with `send()` syntax.



  Version 7.0.0b1 is a preview of our efforts to create a client library that is user friendly and idiomatic to the Python ecosystem. The reasons for most of the changes in this update can be found in the Azure SDK Design Guidelines for Python. For more information, please visit https://aka.ms/azure-sdk-preview1-python.
  * Note: Not all historical functionality exists in this version at this point.  Topics, Subscriptions, scheduling, dead_letter management and more will be added incrementally over upcoming preview releases.

  **New Features**

  * Added new configuration parameters when creating `ServiceBusClient`.
      * `credential`: The credential object used for authentication which implements `TokenCredential` interface of getting tokens.
      * `http_proxy`: A dictionary populated with proxy settings.
      * For detailed information about configuration parameters, please see docstring in `ServiceBusClient` and/or the reference documentation for more information.
  * Added support for authentication using Azure Identity credentials.
  * Added support for retry policy.
  * Added support for http proxy.
  * Manually calling `reconnect` should no longer be necessary, it is now performed implicitly.
  * Manually calling `open` should no longer be necessary, it is now performed implicitly.
      * Note: `close()`-ing is still required if a context manager is not used, to avoid leaking connections.
  * Added support for sending a batch of messages destined for heterogenous sessions.

  **Breaking changes**

  * Simplified API and set of clients
      * `get_queue` no longer exists, utilize `get_queue_sender/receiver` instead.
      * `peek` and other `queue_client` functions have moved to their respective sender/receiver.
      * Renamed `fetch_next` to `receive`.
      * Renamed `session` to `session_id` to normalize naming when requesting a receiver against a given session.
      * `reconnect` no longer exists, and is performed implicitly if needed.
      * `open` no longer exists, and is performed implicitly if needed.
  * Normalized top level client parameters with idiomatic and consistent naming.
      * Renamed `debug` in `ServiceBusClient` initializer to `logging_enable`.
      * Renamed `service_namespace` in `ServiceBusClient` initializer to `fully_qualified_namespace`.
  * New error hierarchy, with more specific semantics
      * `azure.servicebus.exceptions.ServiceBusError`
      * `azure.servicebus.exceptions.ServiceBusConnectionError`
      * `azure.servicebus.exceptions.ServiceBusResourceNotFound`
      * `azure.servicebus.exceptions.ServiceBusAuthorizationError`
      * `azure.servicebus.exceptions.NoActiveSession`
      * `azure.servicebus.exceptions.OperationTimeoutError`
      * `azure.servicebus.exceptions.InvalidHandlerState`
      * `azure.servicebus.exceptions.AutoLockRenewTimeout`
      * `azure.servicebus.exceptions.AutoLockRenewFailed`
      * `azure.servicebus.exceptions.EventDataSendError`
      * `azure.servicebus.exceptions.MessageSendFailed`
      * `azure.servicebus.exceptions.MessageLockExpired`
      * `azure.servicebus.exceptions.MessageSettleFailed`
      * `azure.servicebus.exceptions.MessageAlreadySettled`
      * `azure.servicebus.exceptions.SessionLockExpired`
  * BatchMessage creation is now initiated via `create_batch` on a Sender, using `add()` on the batch to add messages, in order to enforce service-side max batch sized limitations.
  * Session is now set on the message itself, via `session_id` parameter or property, as opposed to on `Send` or `get_sender` via `session`.  This is to allow sending a batch of messages destined to varied sessions.
  * Session management is now encapsulated within a property of a receiver, e.g. `receiver.session`, to better compartmentalize functionality specific to sessions.
      * To use `AutoLockRenew` against sessions, one would simply pass the inner session object, instead of the receiver itself.



  **New Features**

  * Added support for delivery tag lock tokens

  **BugFixes**

  * Fixed bug where Message would pass through invalid kwargs on init when attempting to thread through subject.
  * Increments UAMQP dependency min version to 1.2.5, to include a set of fixes, including handling of large messages and mitigation of segfaults.



  **BugFixes**

  * Fixed bug where enqueued_time and scheduled_enqueue_time of message being parsed as local timestamp rather than UTC.




  **Breaking changes**

  * Introduces new AMQP-based API.
  * Original HTTP-based API still available under new namespace: azure.servicebus.control_client
  * For full API changes, please see updated [reference documentation](https://docs.microsoft.com/python/api/azure-servicebus/azure.servicebus?view=azure-python).

  Within the new namespace, the original HTTP-based API from version 0.21.1 remains unchanged (i.e. no additional features or bugfixes)
  so for those intending to only use HTTP operations - there is no additional benefit in updating at this time.

  **New Features**

  * New API supports message send and receive via AMQP with improved performance and stability.
  * New asynchronous APIs (using `asyncio`) for send, receive and message handling.
  * Support for message and session auto lock renewal via background thread or async operation.
  * Now supports scheduled message cancellation.




  This wheel package is now built with the azure wheel extension



  **New Features**

  * `str` messages are now accepted in Python 3 and will be encoded in 'utf-8' (will not raise TypeError anymore)
  * `broker_properties` can now be defined as a dict, and not only a JSON `str`. datetime, int, float and boolean are converted.
  * #902 add `send_topic_message_batch` operation (takes an iterable of messages)
  * #902 add `send_queue_message_batch` operation (takes an iterable of messages)

  **Bugfixes**

  * #820 the code is now more robust to unexpected changes on the SB RestAPI



  **News**

  * #547 Add get dead letter path static methods to Python
  * #513 Add renew lock

  **Bugfixes**

  * #628 Fix custom properties with double quotes



  **Bugfixes**

  * New header in Rest API which breaks the SDK #658 #657



  **News**

  * Create a requests.Session() if the user doesn't pass one in.



  Initial release of this package, from the split of the `azure` package.
  See the `azure` package release note for 1.0.0 for details and previous
  history on Service Bus.


pkgId: 78549d0dadfbe913ab5e04d46b27d0e8884c03662f59c4a3123a3eaa8cd2e18a
name: python-azure-servicefabric
arch: src
version: 8.2.0.0
epoch: 0
release: 1
summary: Microsoft Azure Service Fabric Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-servicefabric-8.2.0.0-1.src.rpm
checksum_type: sha256
description:
  This is the Microsoft Azure Service Fabric Client Library.
  This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8.
  For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).







  For code examples, see [Service Fabric](https://docs.microsoft.com/python/api/overview/azure/servicefabric) on docs.microsoft.com.




  If you encounter any bugs or have suggestions, please file an issue in the
  [Issues](https://github.com/Azure/azure-sdk-for-python/issues)
  section of the project.


  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-servicefabric%2FREADME.png)






  **Features**

  **Breaking changes**

  Added new operations:
   - Added operation ServiceFabricClientAPIsOperationsMixin.validate_cluster_upgrade
   - Added operation ServiceFabricClientAPIsOperationsMixin.update_application
   - Added operation ServiceFabricClientAPIsOperationsMixin.move_auxiliary_replica

  Added new models:
    - ApplicationUpdateDescription
    - CurrentUpgradeUnitsProgressInfo
    - ServiceHostUpgradeImpact
    - UpgradeDomainDeployedApplicationsHealthEvaluation
    - UpgradeUnitInfo
    - UpgradeUnitState
    - ValidateClusterUpgradeResult



  **Features**

    - Model ApplicationUpgradeDescription has a new parameter managed_application_identity
    - Model StatelessServiceUpdateDescription has a new parameter instance_lifecycle_description
    - Model StatelessServiceUpdateDescription has a new parameter tags_for_running
    - Model StatelessServiceUpdateDescription has a new parameter service_dns_name
    - Model StatelessServiceUpdateDescription has a new parameter tags_for_placement
    - Model StatelessServiceUpdateDescription has a new parameter instance_restart_wait_duration_seconds
    - Model ServiceDescription has a new parameter tags_required_to_place
    - Model ServiceDescription has a new parameter tags_required_to_run
    - Model ServiceUpdateDescription has a new parameter tags_for_placement
    - Model ServiceUpdateDescription has a new parameter tags_for_running
    - Model ServiceUpdateDescription has a new parameter service_dns_name
    - Model StatefulServiceDescription has a new parameter replica_lifecycle_description
    - Model StatefulServiceDescription has a new parameter tags_required_to_place
    - Model StatefulServiceDescription has a new parameter tags_required_to_run
    - Model StatelessServiceDescription has a new parameter instance_lifecycle_description
    - Model StatelessServiceDescription has a new parameter instance_restart_wait_duration_seconds
    - Model StatelessServiceDescription has a new parameter tags_required_to_place
    - Model StatelessServiceDescription has a new parameter tags_required_to_run
    - Model ClusterHealthPolicy has a new parameter node_type_health_policy_map
    - Model NodeInfo has a new parameter node_tags
    - Model StatefulServiceUpdateDescription has a new parameter replica_lifecycle_description
    - Model StatefulServiceUpdateDescription has a new parameter tags_for_placement
    - Model StatefulServiceUpdateDescription has a new parameter tags_for_running
    - Model StatefulServiceUpdateDescription has a new parameter service_dns_name
    - Model ApplicationInfo has a new parameter managed_application_identity
    - Added operation ServiceFabricClientAPIsOperationsMixin.add_node_tags
    - Added operation ServiceFabricClientAPIsOperationsMixin.move_instance
    - Added operation ServiceFabricClientAPIsOperationsMixin.remove_node_tags
    - Added operation ServiceFabricClientAPIsOperationsMixin.get_loaded_partition_info_list

  **Breaking changes**

    - Operation ServiceFabricClientAPIsOperationsMixin.create_backup_policy has a new signature
    - Operation ServiceFabricClientAPIsOperationsMixin.update_backup_policy has a new signature
    - Model AverageServiceLoadScalingTrigger has a new required parameter use_only_primary_load



  **Features**

    - Added `update_partition_load` method to update the loads of provided partitions.



  **Bugfix**

    - Fix ContainerCodePackageProperties entrypoint to entry_point



  This is re-release of 6.6.0.0 to match the actual API version used
  internally



  **Features**

    - Model StartClusterUpgradeDescription has a new parameter
      instance_close_delay_duration_in_seconds
    - Model Setting has a new parameter type
    - Model ApplicationUpgradeDescription has a new parameter
      instance_close_delay_duration_in_seconds
    - Model HealthEvent has a new parameter health_report_id
    - Model HealthInformation has a new parameter health_report_id
    - Model StatelessServiceDescription has a new parameter flags
    - Model StatelessServiceDescription has a new parameter
      min_instance_count
    - Model StatelessServiceDescription has a new parameter
      min_instance_percentage
    - Model StatelessServiceDescription has a new parameter
      instance_close_delay_duration_seconds
    - Model StatefulServiceDescription has a new parameter
      service_placement_time_limit_seconds
    - Model ImageRegistryCredential has a new parameter password_type
    - Model ContainerCodePackageProperties has a new parameter
      liveness_probe
    - Model ContainerCodePackageProperties has a new parameter
      readiness_probe
    - Model ServiceResourceDescription has a new parameter
      execution_policy
    - Model ServiceResourceDescription has a new parameter dns_name
    - Model StatefulServiceUpdateDescription has a new parameter
      service_placement_time_limit_seconds
    - Model EnvironmentVariable has a new parameter type
    - Model StatelessServicePartitionInfo has a new parameter
      min_instance_percentage
    - Model StatelessServicePartitionInfo has a new parameter
      min_instance_count
    - Model RollingUpgradeUpdateDescription has a new parameter
      instance_close_delay_duration_in_seconds
    - Model ServiceProperties has a new parameter execution_policy
    - Model ServiceProperties has a new parameter dns_name
    - Model StatelessServiceUpdateDescription has a new parameter
      min_instance_percentage
    - Model StatelessServiceUpdateDescription has a new parameter
      min_instance_count
    - Model StatelessServiceUpdateDescription has a new parameter
      instance_close_delay_duration_seconds
    - Added operation MeshApplicationOperations.get_upgrade_progress
    - Added operation
      ServiceFabricClientAPIsOperationsMixin.remove_configuration_overrides
    - Added operation
      ServiceFabricClientAPIsOperationsMixin.get_image_store_info
    - Added operation
      ServiceFabricClientAPIsOperationsMixin.get_configuration_overrides
    - Added operation
      ServiceFabricClientAPIsOperationsMixin.add_configuration_parameter_overrides



  **Features**

    - Model ApplicationDescription has a new parameter
      managed_application_identity
    - Model ApplicationUpgradeDescription has a new parameter sort_order
    - Model NodeLoadMetricInformation has a new parameter
      planned_node_load_removal
    - Model NodeLoadMetricInformation has a new parameter
      current_node_load
    - Model NodeLoadMetricInformation has a new parameter
      buffered_node_capacity_remaining
    - Model NodeLoadMetricInformation has a new parameter
      node_capacity_remaining
    - Model StartClusterUpgradeDescription has a new parameter sort_order
    - Model ApplicationResourceDescription has a new parameter identity
    - Model ServiceResourceDescription has a new parameter identity_refs
    - Model ClusterUpgradeDescriptionObject has a new parameter
      sort_order
    - Model ServiceProperties has a new parameter identity_refs

  **Breaking changes**

    - Model ChaosStartedEvent no longer has parameter
      wait_time_between_fautls_in_seconds
    - Model ChaosStartedEvent has a new required parameter
      wait_time_between_faults_in_seconds



  **Bugfixes**

    - Numerous improvements to descriptions and help texts

  **Features**

    - Add command to get cluster load
    - Add command to get cluster version
    - Add mesh gateway support
    - Add mesh support
    - Add command for rolling back compose deployment upgrades
    - Various new parameters added.



  **Bugfixes**

    - Numerous improvements to descriptions and help texts

  **Features**

    - Add application health policies parameter for config upgrade
    - Query to get nodes now supports specification to limit number of
      returned items



  **General Breaking changes**

  This version uses a next-generation code generator that *might*
  introduce breaking changes.

    - Model signatures now use only keyword-argument syntax. All
      positional arguments must be re-written as keyword-arguments. To
      keep auto-completion in most cases, models are now generated for
      Python 2 and Python 3. Python 3 uses the "*" syntax for
      keyword-only arguments.
    - Enum types now use the "str" mixin (class AzureEnum(str, Enum)) to
      improve the behavior when unrecognized enum values are encountered.
      While this is not a breaking change, the distinctions are important,
      and are documented here:
      <https://docs.python.org/3/library/enum.html#others> At a glance:
        - "is" should not be used at all.
        - "format" will return the string value, where "%s" string
          formatting will return `NameOfEnum.stringvalue`. Format syntax
          should be prefered.
    - New Long Running Operation:
        - Return type changes from
          `msrestazure.azure_operation.AzureOperationPoller` to
          `msrest.polling.LROPoller`. External API is the same.
        - Return type is now **always** a `msrest.polling.LROPoller`,
          regardless of the optional parameters used.
        - The behavior has changed when using `raw=True`. Instead of
          returning the initial call result as `ClientRawResponse`,
          without polling, now this returns an LROPoller. After polling,
          the final resource will be returned as a `ClientRawResponse`.
        - New `polling` parameter. The default behavior is
          `Polling=True` which will poll using ARM algorithm. When
          `Polling=False`, the response of the initial call will be
          returned without polling.
        - `polling` parameter accepts instances of subclasses of
          `msrest.polling.PollingMethod`.
        - `add_done_callback` will no longer raise if called after
          polling is finished, but will instead execute the callback right
          away.

  **Bugfixes**

    - Numerous fixes to descriptions and help text of entities
    - Compatibility of the sdist with wheel 0.31.0

  **Features**

    - Add support for invoking container APIs
    - Add option to fetch container logs from exited containers
    - Query to get chaos events now supports specification to limit number
      of returned items
    - Client class can be used as a context manager to keep the underlying
      HTTP session open for performance



  **Bugfixes**

    - Numerous fixes to descriptions and help text of entities

  **Features**

    - Chaos service now supports a target filter
    - Application types can now be provisioned and created in external
      stores
    - Added Orchestration Service internal support APIs
    - Added container deployment management APIs



  This version was broken and has been removed from PyPI.



  **Bugfixes**

    - remove application_type_version in
      get_application_type_info_list_by_name
    - fix application_type_definition_kind_filter default value from
      65535 to 0

  **Features**

    - add create_name, get_name_exists_info, delete_name,
      get_sub_name_info_list, get_property_info_list,
      put_property, get_property_info, delete_property,
      submit_property_batch



  **Bug fix**

    - Fix some unexpected exceptions



    - Stable 6.0 api



    - Release candidate for Service Fabric 6.0 runtime



    - Initial Release


pkgId: e56dedbca31dfac802c8bb2f064e0560f41799953894187b98fe8c0d0c072285
name: python-azure-servicemanagement-legacy
arch: src
version: 0.20.7
epoch: 0
release: 1
summary: Microsoft Azure Legacy Service Management Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: Apache License 2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-servicemanagement-legacy-0.20.7-1.src.rpm
checksum_type: sha256
description:
  This is the Microsoft Azure Service Management Legacy Client Library.

  All packages in this bundle have been tested with Python 2.7, 3.3, 3.4 and 3.5.

  For the newer Azure Resource Management (ARM) libraries, see [azure-mgmt](https://pypi.python.org/pypi/azure-mgmt).

  For a more complete set of Azure libraries, see the [azure](https://pypi.python.org/pypi/azure) bundle package.




  **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:

  ```shell
  pip freeze
  ```

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

  ```shell
  pip uninstall azure
  ```



  -  Cloud Service management (Virtual Machines, VM Images, OS Images)
  -  Storage accounts management
  -  Scheduler management
  -  Service Bus management
  -  Affinity Group management
  -  Management certificate management
  -  Web Apps (Website) management






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

  ```shell
  pip install azure-servicemanagement-legacy
  ```




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

  ```shell
  git clone https://github.com/Azure/azure-sdk-for-python.git
  cd azure-sdk-for-python
  cd azure-servicemanagement-legacy
  python setup.py install
  ```








  You will need two certificates, one for the server (a .cer file) and one for
  the client (a .pem file).



  You can download your Azure publish settings file and use the certificate that
  is embedded in that file to create the client certificate. The server
  certificate already exists, so you won't need to upload one.

  To do this, download your [publish settings](http://go.microsoft.com/fwlink/?LinkID=301775)
  then use this code to create the .pem file.

  ```python
  from azure.servicemanagement import get_certificate_from_publish_settings

  subscription_id = get_certificate_from_publish_settings(
      publish_settings_path='MyAccount.PublishSettings',
      path_to_write_certificate='mycert.pem',
      subscription_id='00000000-0000-0000-0000-000000000000',
  )
  ```

  The subscription id parameter is optional. If there are more than one
  subscription in the publish settings, the first one will be used.



  To create the .pem file using [OpenSSL](http://www.openssl.org), execute this:

  ```shell
  openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
  ```
  To create the .cer certificate, execute this:

  ```shell
  openssl x509 -inform pem -in mycert.pem -outform der -out mycert.cer
  ```

  After you have created the certificate, you will need to upload the .cer
  file to Microsoft Azure via the "Upload" action of the "Settings" tab of
  the [management portal](http://manage.windowsazure.com).






  To initialize the management service, pass in your subscription id and
  the path to the .pem file.

  ```python
  from azure.servicemanagement import ServiceManagementService
  subscription_id = '00000000-0000-0000-0000-000000000000'
  cert_file = 'mycert.pem'
  sms = ServiceManagementService(subscription_id, cert_file)
  ```



  ```python
  locations = sms.list_locations()
  for location in locations:
      print(location.name)
  ```



  To create a storage service, you need a name for the service (between 3
  and 24 lowercase characters and unique within Microsoft Azure), a label
  (up to 100 characters, automatically encoded to base-64), and either a
  location or an affinity group.

  ```python
  name = "mystorageservice"
  desc = name
  label = name
  location = 'West US'

  result = sms.create_storage_account(name, desc, label, location=location)
  sms.wait_for_operation_status(result.request_id, timeout=30)
  ```



  A cloud service is also known as a hosted service (from earlier versions
  of Microsoft Azure). The **create\_hosted\_service** method allows you
  to create a new hosted service by providing a hosted service name (which
  must be unique in Microsoft Azure), a label (automatically encoded to
  base-64), and the location *or* the affinity group for your service.

  ```python
  name = "myhostedservice"
  desc = name
  label = name
  location = 'West US'

  result = sms.create_hosted_service(name, label, desc, location=location)
  sms.wait_for_operation_status(result.request_id, timeout=30)
  ```



  To create a virtual machine, you first need to create a cloud service.
  Then create the virtual machine deployment using the
  create_virtual_machine_deployment method.

  ```python
  from azure.servicemanagement import LinuxConfigurationSet, OSVirtualHardDisk

  name = "myhostedservice"


  image_name = 'OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd'



  media_link = 'url_to_target_storage_blob_for_vm_hd'



  linux_config = LinuxConfigurationSet(
      'myhostname',
      'myuser',
      'mypassword',
      disable_ssh_password_authentication=True,
  )

  os_hd = OSVirtualHardDisk(image_name, media_link)

  result = sms.create_virtual_machine_deployment(
      service_name=name,
      deployment_name=name,
      deployment_slot='production',
      label=name,
      role_name=name,
      system_config=linux_config,
      os_virtual_hard_disk=os_hd,
      role_size='Small',
  )
  sms.wait_for_operation_status(result.request_id, timeout=600)
  ```




  Be sure to check out the Microsoft Azure [Developer Forums on Stack
  Overflow](http://go.microsoft.com/fwlink/?LinkId=234489) if you have
  trouble with the provided code.




  If you would like to become an active contributor to this project please
  follow the instructions provided in [Microsoft Azure Projects
  Contribution
  Guidelines](http://azure.github.io/guidelines.html).

  If you encounter any bugs with the library please file an issue in the
  [Issues](https://github.com/Azure/azure-sdk-for-python/issues)
  section of the project.




  [Microsoft Azure Python Developer
  Center](http://azure.microsoft.com/en-us/develop/python/)


  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-servicemanagement-legacy%2FREADME.png)


pkgId: 436fc1decd1cf82542ad6b0d85e0b200d91609a6ccd6897020134ac1cb014fce
name: python-azure-simple-email
arch: src
version: 0.1.3
epoch: 0
release: 1
summary: This is an esperimental library to send email using Microsoft Graph API
url: https://github.com/marcotn/azure_simple_email
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-simple-email-0.1.3-1.src.rpm
checksum_type: sha256
description:
  Python library to send email trough azure service api

  This tool is very simple to use provided you already have an active account with Microsoft Azure Cloud.

  To ba able to access Azure Api this library will look for 3 environment variables

  AZURE_EMAIL_CLIENT_ID
  AZURE_EMAIL_CLIENT_SECRET
  AZURE_EMAIL_AUTHORITY

  You can find these values inside your Azure Entra DI services,

  Moreover to send an email you need to have a valid Microsoft email account inside the organization

  The you call instantiate AzureSendEmail passing the sender's email as paramenter

  this is the example that I have tested here of course with different email address.

  `azure_email = AzureSendMail(user_id='service@example.com')
  azure_email.add_recipient('marco@test.com')
  azure_email.add_attachment('../README.md')
  azure_email.send_email(subject='test message', text='Hi, we are testing this python tool')
  `


pkgId: 0cc1260b1831ccf03b24b8b12b900a12179aff8ae756f5e653c5058fb0dffa51
name: python-azure-storage-blob
arch: src
version: 12.23.0
epoch: 0
release: 1
summary: Microsoft Azure Blob Storage Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-storage-blob-12.23.0-1.src.rpm
checksum_type: sha256
description:
  Azure Blob storage is Microsoft's object storage solution for the cloud. Blob storage is optimized for storing massive amounts of unstructured data, such as text or binary data.

  Blob storage is ideal for:

  * Serving images or documents directly to a browser
  * Storing files for distributed access
  * Streaming video and audio
  * Storing data for backup and restore, disaster recovery, and archiving
  * Storing data for analysis by an on-premises or Azure-hosted service

  [Source code](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/azure/storage/blob)
  | [Package (PyPI)](https://pypi.org/project/azure-storage-blob/)
  | [Package (Conda)](https://anaconda.org/microsoft/azure-storage/)
  | [API reference documentation](https://aka.ms/azsdk-python-storage-blob-ref)
  | [Product documentation](https://docs.microsoft.com/azure/storage/)
  | [Samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/samples)





  * Python 3.8 or later is required to use this package. For more details, please read our page on [Azure SDK for Python version support policy](https://github.com/Azure/azure-sdk-for-python/wiki/Azure-SDKs-Python-version-support-policy).
  * You must have an [Azure subscription](https://azure.microsoft.com/free/) and an
  [Azure storage account](https://docs.microsoft.com/azure/storage/common/storage-account-overview) to use this package.


  Install the Azure Storage Blobs client library for Python with [pip](https://pypi.org/project/pip/):

  ```bash
  pip install azure-storage-blob
  ```


  If you wish to create a new storage account, you can use the
  [Azure Portal](https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal),
  [Azure PowerShell](https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-powershell),
  or [Azure CLI](https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-cli):

  ```bash


  az group create --name my-resource-group --location westus2


  az storage account create -n my-storage-account-name -g my-resource-group
  ```


  The Azure Storage Blobs client library for Python allows you to interact with three types of resources: the storage
  account itself, blob storage containers, and blobs. Interaction with these resources starts with an instance of a
  [client](#clients). To create a client object, you will need the storage account's blob service account URL and a
  credential that allows you to access the storage account:

  ```python
  from azure.storage.blob import BlobServiceClient

  service = BlobServiceClient(account_url="https://<my-storage-account-name>.blob.core.windows.net/", credential=credential)
  ```


  You can find the storage account's blob service URL using the
  [Azure Portal](https://docs.microsoft.com/azure/storage/common/storage-account-overview#storage-account-endpoints),
  [Azure PowerShell](https://docs.microsoft.com/powershell/module/az.storage/get-azstorageaccount),
  or [Azure CLI](https://docs.microsoft.com/cli/azure/storage/account?view=azure-cli-latest#az-storage-account-show):

  ```bash

  az storage account show -n my-storage-account-name -g my-resource-group --query "primaryEndpoints.blob"
  ```


  The `credential` parameter may be provided in a number of different forms, depending on the type of
  [authorization](https://docs.microsoft.com/azure/storage/common/storage-auth) you wish to use:
  1. To use an [Azure Active Directory (AAD) token credential](https://docs.microsoft.com/azure/storage/common/storage-auth-aad),
     provide an instance of the desired credential type obtained from the
     [azure-identity](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials) library.
     For example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential)
     can be used to authenticate the client.

     This requires some initial setup:
     * [Install azure-identity](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#install-the-package)
     * [Register a new AAD application](https://docs.microsoft.com/azure/active-directory/develop/quickstart-register-app) and give permissions to access Azure Storage
     * [Grant access](https://docs.microsoft.com/azure/storage/common/storage-auth-aad-rbac-portal) to Azure Blob data with RBAC in the Azure Portal
     * Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
       AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET

     Use the returned token credential to authenticate the client:
      ```python
          from azure.identity import DefaultAzureCredential
          from azure.storage.blob import BlobServiceClient
          token_credential = DefaultAzureCredential()

          blob_service_client = BlobServiceClient(
              account_url="https://<my_account_name>.blob.core.windows.net",
              credential=token_credential
          )
      ```

  2. To use a [shared access signature (SAS) token](https://docs.microsoft.com/azure/storage/common/storage-sas-overview),
     provide the token as a string. If your account URL includes the SAS token, omit the credential parameter.
     You can generate a SAS token from the Azure Portal under "Shared access signature" or use one of the `generate_sas()`
     functions to create a sas token for the storage account, container, or blob:

      ```python
      from datetime import datetime, timedelta
      from azure.storage.blob import BlobServiceClient, generate_account_sas, ResourceTypes, AccountSasPermissions

      sas_token = generate_account_sas(
          account_name="<storage-account-name>",
          account_key="<account-access-key>",
          resource_types=ResourceTypes(service=True),
          permission=AccountSasPermissions(read=True),
          expiry=datetime.utcnow() + timedelta(hours=1)
      )

      blob_service_client = BlobServiceClient(account_url="https://<my_account_name>.blob.core.windows.net", credential=sas_token)
      ```

  3. To use a storage account [shared key](https://docs.microsoft.com/rest/api/storageservices/authenticate-with-shared-key/)
     (aka account key or access key), provide the key as a string. This can be found in the Azure Portal under the "Access Keys"
     section or by running the following Azure CLI command:

      ```az storage account keys list -g MyResourceGroup -n MyStorageAccount```

      Use the key as the credential parameter to authenticate the client:
      ```python
      from azure.storage.blob import BlobServiceClient
      service = BlobServiceClient(account_url="https://<my_account_name>.blob.core.windows.net", credential="<account_access_key>")
      ```

      If you are using **customized url** (which means the url is not in this format `<my_account_name>.blob.core.windows.net`),
      please instantiate the client using the credential below:
      ```python
      from azure.storage.blob import BlobServiceClient
      service = BlobServiceClient(account_url="https://<my_account_name>.blob.core.windows.net",
         credential={"account_name": "<your_account_name>", "account_key":"<account_access_key>"})
      ```

  4. To use [anonymous public read access](https://docs.microsoft.com/azure/storage/blobs/storage-manage-access-to-resources),
     simply omit the credential parameter.


  Depending on your use case and authorization method, you may prefer to initialize a client instance with a storage
  connection string instead of providing the account URL and credential separately. To do this, pass the storage
  connection string to the client's `from_connection_string` class method:

  ```python
  from azure.storage.blob import BlobServiceClient

  connection_string = "DefaultEndpointsProtocol=https;AccountName=xxxx;AccountKey=xxxx;EndpointSuffix=core.windows.net"
  service = BlobServiceClient.from_connection_string(conn_str=connection_string)
  ```

  The connection string to your storage account can be found in the Azure Portal under the "Access Keys" section or by running the following CLI command:

  ```bash
  az storage account show-connection-string -g MyResourceGroup -n MyStorageAccount
  ```


  The following components make up the Azure Blob Service:
  * The storage account itself
  * A container within the storage account
  * A blob within a container

  The Azure Storage Blobs client library for Python allows you to interact with each of these components through the
  use of a dedicated client object.


  Four different clients are provided to interact with the various components of the Blob Service:
  1. [BlobServiceClient](https://aka.ms/azsdk-python-storage-blob-blobserviceclient) -
      this client represents interaction with the Azure storage account itself, and allows you to acquire preconfigured
      client instances to access the containers and blobs within. It provides operations to retrieve and configure the
      account properties as well as list, create, and delete containers within the account. To perform operations on a
      specific container or blob, retrieve a client using the `get_container_client` or `get_blob_client` methods.
  2. [ContainerClient](https://aka.ms/azsdk-python-storage-blob-containerclient) -
      this client represents interaction with a specific container (which need not exist yet), and allows you to acquire
      preconfigured client instances to access the blobs within. It provides operations to create, delete, or configure a
      container and includes operations to list, upload, and delete the blobs within it. To perform operations on a
      specific blob within the container, retrieve a client using the `get_blob_client` method.
  3. [BlobClient](https://aka.ms/azsdk-python-storage-blob-blobclient) -
      this client represents interaction with a specific blob (which need not exist yet). It provides operations to
      upload, download, delete, and create snapshots of a blob, as well as specific operations per blob type.
  4. [BlobLeaseClient](https://aka.ms/azsdk-python-storage-blob-blobleaseclient) -
      this client represents lease interactions with a `ContainerClient` or `BlobClient`. It provides operations to
      acquire, renew, release, change, and break a lease on a specified resource.


  This library includes a complete async API supported on Python 3.5+. To use it, you must
  first install an async transport, such as [aiohttp](https://pypi.org/project/aiohttp/).
  See
  [azure-core documentation](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#transport)
  for more information.

  Async clients and credentials should be closed when they're no longer needed. These
  objects are async context managers and define async `close` methods.


  Once you've initialized a Client, you can choose from the different types of blobs:
  * [Block blobs](https://docs.microsoft.com/rest/api/storageservices/understanding-block-blobs--append-blobs--and-page-blobs#about-block-blobs)
    store text and binary data, up to approximately 4.75 TiB. Block blobs are made up of blocks of data that can be
    managed individually
  * [Append blobs](https://docs.microsoft.com/rest/api/storageservices/understanding-block-blobs--append-blobs--and-page-blobs#about-append-blobs)
    are made up of blocks like block blobs, but are optimized for append operations. Append blobs are ideal for scenarios
    such as logging data from virtual machines
  * [Page blobs](https://docs.microsoft.com/rest/api/storageservices/understanding-block-blobs--append-blobs--and-page-blobs#about-page-blobs)
    store random access files up to 8 TiB in size. Page blobs store virtual hard drive (VHD) files and serve as disks for
    Azure virtual machines


  The following sections provide several code snippets covering some of the most common Storage Blob tasks, including:

  * [Create a container](#create-a-container "Create a container")
  * [Uploading a blob](#uploading-a-blob "Uploading a blob")
  * [Downloading a blob](#downloading-a-blob "Downloading a blob")
  * [Enumerating blobs](#enumerating-blobs "Enumerating blobs")

  Note that a container must be created before to upload or download a blob.



  Create a container from where you can upload or download blobs.
  ```python
  from azure.storage.blob import ContainerClient

  container_client = ContainerClient.from_connection_string(conn_str="<connection_string>", container_name="mycontainer")

  container_client.create_container()
  ```

  Use the async client to create a container

  ```python
  from azure.storage.blob.aio import ContainerClient

  container_client = ContainerClient.from_connection_string(conn_str="<connection_string>", container_name="mycontainer")

  await container_client.create_container()
  ```


  Upload a blob to your container

  ```python
  from azure.storage.blob import BlobClient

  blob = BlobClient.from_connection_string(conn_str="<connection_string>", container_name="mycontainer", blob_name="my_blob")

  with open("./SampleSource.txt", "rb") as data:
      blob.upload_blob(data)
  ```

  Use the async client to upload a blob

  ```python
  from azure.storage.blob.aio import BlobClient

  blob = BlobClient.from_connection_string(conn_str="<connection_string>", container_name="mycontainer", blob_name="my_blob")

  with open("./SampleSource.txt", "rb") as data:
      await blob.upload_blob(data)
  ```


  Download a blob from your container

  ```python
  from azure.storage.blob import BlobClient

  blob = BlobClient.from_connection_string(conn_str="<connection_string>", container_name="mycontainer", blob_name="my_blob")

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

  Download a blob asynchronously

  ```python
  from azure.storage.blob.aio import BlobClient

  blob = BlobClient.from_connection_string(conn_str="<connection_string>", container_name="mycontainer", blob_name="my_blob")

  with open("./BlockDestination.txt", "wb") as my_blob:
      stream = await blob.download_blob()
      data = await stream.readall()
      my_blob.write(data)
  ```


  List the blobs in your container

  ```python
  from azure.storage.blob import ContainerClient

  container = ContainerClient.from_connection_string(conn_str="<connection_string>", container_name="mycontainer")

  blob_list = container.list_blobs()
  for blob in blob_list:
      print(blob.name + '\n')
  ```

  List the blobs asynchronously

  ```python
  from azure.storage.blob.aio import ContainerClient

  container = ContainerClient.from_connection_string(conn_str="<connection_string>", container_name="mycontainer")

  blob_list = []
  async for blob in container.list_blobs():
      blob_list.append(blob)
  print(blob_list)
  ```



  Optional keyword arguments that can be passed in at the client and per-operation level.



  Use the following keyword arguments when instantiating a client to configure the retry policy:

  * __retry_total__ (int): Total number of retries to allow. Takes precedence over other counts.
  Pass in `retry_total=0` if you do not want to retry on requests. Defaults to 10.
  * __retry_connect__ (int): How many connection-related errors to retry on. Defaults to 3.
  * __retry_read__ (int): How many times to retry on read errors. Defaults to 3.
  * __retry_status__ (int): How many times to retry on bad status codes. Defaults to 3.
  * __retry_to_secondary__ (bool): Whether the request should be retried to secondary, if able.
  This should only be enabled of RA-GRS accounts are used and potentially stale data can be handled.
  Defaults to `False`.



  Use the following keyword arguments when instantiating a client to configure encryption:

  * __require_encryption__ (bool): If set to True, will enforce that objects are encrypted and decrypt them.
  * __encryption_version__ (str): Specifies the version of encryption to use. Current options are `'2.0'` or `'1.0'` and
  the default value is `'1.0'`. Version 1.0 is deprecated, and it is **highly recommended** to use version 2.0.
  * __key_encryption_key__ (object): The user-provided key-encryption-key. The instance must implement the following methods:
      - `wrap_key(key)`--wraps the specified key using an algorithm of the user's choice.
      - `get_key_wrap_algorithm()`--returns the algorithm used to wrap the specified symmetric key.
      - `get_kid()`--returns a string key id for this key-encryption-key.
  * __key_resolver_function__ (callable): The user-provided key resolver. Uses the kid string to return a key-encryption-key
  implementing the interface defined above.



  Other optional configuration keyword arguments that can be specified on the client or per-operation.

  **Client keyword arguments:**

  * __connection_timeout__ (int): The number of seconds the client will wait to establish a connection to the server.
  Defaults to 20 seconds.
  * __read_timeout__ (int): The number of seconds the client will wait, between consecutive read operations, for a
  response from the server. This is a socket level timeout and is not affected by overall data size. Client-side read
  timeouts will be automatically retried. Defaults to 60 seconds.
  * __transport__ (Any): User-provided transport to send the HTTP request.

  **Per-operation keyword arguments:**

  * __raw_response_hook__ (callable): The given callback uses the response returned from the service.
  * __raw_request_hook__ (callable): The given callback uses the request before being sent to service.
  * __client_request_id__ (str): Optional user specified identification of the request.
  * __user_agent__ (str): Appends the custom value to the user-agent header to be sent with the request.
  * __logging_enable__ (bool): Enables logging at the DEBUG level. Defaults to False. Can also be passed in at
  the client level to enable it for all requests.
  * __logging_body__ (bool): Enables logging the request and response body. Defaults to False. Can also be passed in at
  the client level to enable it for all requests.
  * __headers__ (dict): Pass in custom headers as key, value pairs. E.g. `headers={'CustomValue': value}`



  Storage Blob clients raise exceptions defined in [Azure Core](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md).

  This list can be used for reference to catch thrown exceptions. To get the specific error code of the exception, use the `error_code` attribute, i.e, `exception.error_code`.


  This library uses the standard
  [logging](https://docs.python.org/3/library/logging.html) library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` argument:
  ```python
  import sys
  import logging
  from azure.storage.blob import BlobServiceClient


  logger = logging.getLogger('azure.storage.blob')
  logger.setLevel(logging.DEBUG)


  handler = logging.StreamHandler(stream=sys.stdout)
  logger.addHandler(handler)


  service_client = BlobServiceClient.from_connection_string("your_connection_string", logging_enable=True)
  ```

  Similarly, `logging_enable` can enable detailed logging for a single operation,
  even when it isn't enabled for the client:
  ```python
  service_client.get_service_stats(logging_enable=True)
  ```





  Get started with our [Blob samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/samples).

  Several Storage Blobs Python SDK samples are available to you in the SDK's GitHub repository. These samples provide example code for additional scenarios commonly encountered while working with Storage Blobs:

  * [blob_samples_container_access_policy.py](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/samples/blob_samples_container_access_policy.py) ([async version](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/samples/blob_samples_container_access_policy_async.py)) - Examples to set Access policies:
      * Set up Access Policy for container

  * [blob_samples_hello_world.py](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/samples/blob_samples_hello_world.py) ([async version](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/samples/blob_samples_hello_world_async.py)) - Examples for common Storage Blob tasks:
      * Set up a container
      * Create a block, page, or append blob
      * Upload blobs
      * Download blobs
      * Delete blobs

  * [blob_samples_authentication.py](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/samples/blob_samples_authentication.py) ([async version](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/samples/blob_samples_authentication_async.py)) - Examples for authenticating and creating the client:
      * From a connection string
      * From a shared access key
      * From a shared access signature token
      * From active directory

  * [blob_samples_service.py](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/samples/blob_samples_service.py) ([async version](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/samples/blob_samples_service_async.py)) - Examples for interacting with the blob service:
      * Get account information
      * Get and set service properties
      * Get service statistics
      * Create, list, and delete containers
      * Get the Blob or Container client

  * [blob_samples_containers.py](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/samples/blob_samples_containers.py) ([async version](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/samples/blob_samples_containers_async.py)) - Examples for interacting with containers:
      * Create a container and delete containers
      * Set metadata on containers
      * Get container properties
      * Acquire a lease on container
      * Set an access policy on a container
      * Upload, list, delete blobs in container
      * Get the blob client to interact with a specific blob

  * [blob_samples_common.py](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/samples/blob_samples_common.py) ([async version](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/samples/blob_samples_common_async.py)) - Examples common to all types of blobs:
      * Create a snapshot
      * Delete a blob snapshot
      * Soft delete a blob
      * Undelete a blob
      * Acquire a lease on a blob
      * Copy a blob from a URL

  * [blob_samples_directory_interface.py](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob/samples/blob_samples_directory_interface.py) - Examples for interfacing with Blob storage as if it were a directory on a filesystem:
      * Copy (upload or download) a single file or directory
      * List files or directories at a single level or recursively
      * Delete a single file or recursively delete a directory


  For more extensive documentation on Azure Blob storage, see the [Azure Blob storage documentation](https://docs.microsoft.com/azure/storage/blobs/) on docs.microsoft.com.


  This project welcomes contributions and suggestions.  Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.


