ChangeFeedClient Class
A client to interact with a specific account change feed.
- Inheritance
-
builtins.objectChangeFeedClient
Constructor
ChangeFeedClient(account_url: str, credential: Optional[Any] = None, **kwargs: Any)
Parameters
- 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 instance of a AzureSasCredential from azure.core.credentials, an account shared access key, or an instance of a TokenCredentials class from azure.identity. If the resource URI already contains a SAS token, this will be ignored in favor of an explicit credential
- except in the case of AzureSasCredential, where the conflicting SAS tokens will raise a ValueError.
- secondary_hostname
- str
The hostname of the secondary endpoint.
- max_single_get_size
- int
The maximum size for a changefeed blob to be downloaded in a single call, the exceeded part will be downloaded in chunks.
- max_chunk_get_size
- int
The maximum chunk size used for downloading a changefeed blob.
- api_version
- str
The Storage API version to use for requests. Default value is the most recent service version that is compatible with the current SDK. Setting to an older version may result in reduced feature compatibility.
Examples
Creating the ChangeFeedClient from a URL to a public blob (no auth needed).
cf_client = ChangeFeedClient("https://{}.blob.core.windows.net".format(self.ACCOUNT_NAME),
credential=self.ACCOUNT_KEY)
Methods
| from_connection_string |
Create ChangeFeedClient from a Connection String. |
| list_changes |
Returns a generator to list the change feed events. The generator will lazily follow the continuation tokens returned by the service. |
from_connection_string
Create ChangeFeedClient from a Connection String.
from_connection_string(conn_str: str, credential: Optional[Any] = None, **kwargs: Any) -> azure.storage.blob.changefeed._change_feed_client.ChangeFeedClient
Parameters
- 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 instance of a AzureSasCredential from azure.core.credentials, 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.
- credential
Returns
A change feed client.
Return type
list_changes
Returns a generator to list the change feed events. The generator will lazily follow the continuation tokens returned by the service.
list_changes(**kwargs: Any) -> azure.core.paging.ItemPaged[Dict]
Parameters
- start_time
- datetime
Filters the results to return only events which happened after this time.
- end_time
- datetime
Filters the results to return only events which happened before this time.
- results_per_page
- int
The page size when list events by page using by_page() method on the generator.
Returns
An iterable (auto-paging) response of events whose type is dictionary.
Return type
Examples
List all change feed events.
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)
List change feed events by page.
# [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)
Feedback
Submit and view feedback for