Python용 Azure Notification Hubs 라이브러리

관리 API

pip install azure-mgmt-notificationhubs

관리 클라이언트 만들기

다음 코드는 관리 클라이언트의 인스턴스를 만듭니다.

구독 목록에서 검색할 수 있는 항목을 제공해야 subscription_id 합니다.

Python SDK를 사용하여 Azure Active Directory 인증을 처리하고 Credentials 인스턴스를 만드는 방법에 대한 자세한 내용은 리소스 관리 인증을 참조하세요.

from azure.mgmt.notificationhubs import NotificationHubsManagementClient
from azure.common.credentials import UserPassCredentials

# Replace this with your subscription id
subscription_id = '33333333-3333-3333-3333-333333333333'

# See above for details on creating different types of AAD credentials
credentials = UserPassCredentials(
    'user@domain.com',	# Your user
    'my_password',		# Your password
)

redis_client = NotificationHubsManagementClient(
    credentials,
    subscription_id
)

네임스페이스 가용성 확인

다음 코드는 알림 허브의 네임스페이스의 가용성을 확인합니다.

from azure.mgmt.notificationhubs.models import CheckAvailabilityParameters

account_name = 'mynotificationhub'
output = notificationhubs_client.namespaces.check_availability(
    azure.mgmt.notificationhubs.models.CheckAvailabilityParameters(
        name = account_name
    )
)
# output is a CheckAvailibilityResource instance
print(output.is_availiable) # Yes, it's 'availiable', it's a typo in the REST API