azure.storage.blob.changefeed package¶
-
class
azure.storage.blob.changefeed.
ChangeFeedClient
(account_url: str, credential: Optional[Any] = None, **kwargs: Any)[source]¶ A client to interact with a specific account change feed.
- Parameters
account_url (str) – The URI to the storage account.
credential – The credentials with which to authenticate. This is optional if the account URL already has a SAS token. The value can be a SAS token string, an account shared access key, or an instance of a TokenCredentials class from azure.identity. If the URL already has a SAS token, specifying an explicit credential will take priority.
- Keyword Arguments
secondary_hostname (str) – The hostname of the secondary endpoint.
Example:
cf_client = ChangeFeedClient("https://{}.blob.core.windows.net".format(self.ACCOUNT_NAME), credential=self.ACCOUNT_KEY)
-
classmethod
from_connection_string
(conn_str: str, credential: Optional[Any] = None, **kwargs: Any) → azure.storage.blob.changefeed._change_feed_client.ChangeFeedClient[source]¶ Create ChangeFeedClient from a Connection String.
- Parameters
conn_str (str) – A connection string to an Azure Storage account.
credential – The credentials with which to authenticate. This is optional if the account URL already has a SAS token, or the connection string already has shared access key values. The value can be a SAS token string, an account shared access key, or an instance of a TokenCredentials class from azure.identity. Credentials provided here will take precedence over those in the connection string.
- Returns
A change feed client.
- Return type
Example:
-
list_changes
(**kwargs: Optional[datetime]) → ItemPaged[Dict][source]¶ Returns a generator to list the change feed events. The generator will lazily follow the continuation tokens returned by the service.
- Keyword Arguments
- Returns
An iterable (auto-paging) response of events whose type is dictionary.
- Return type
Example:
cf_client = ChangeFeedClient("https://{}.blob.core.windows.net".format(self.ACCOUNT_NAME), credential=self.ACCOUNT_KEY) change_feed = cf_client.list_changes() # print all events for event in change_feed: print(event)
# [START create_change_feed_client] cf_client = ChangeFeedClient("https://{}.blob.core.windows.net".format(self.ACCOUNT_NAME), credential=self.ACCOUNT_KEY) # [END create_change_feed_client] change_feed = cf_client.list_changes(results_per_page=10).by_page() # print first page of events change_feed_page1 = next(change_feed) for event in change_feed_page1: print(event) # print second page of events change_feed_page2 = next(change_feed) for event in change_feed_page2: print(event)