Registry / azure / azure-communication-phonenumbers

azure-communication-phonenumbers

JSON →
library1.4.0pypypi✓ verified 85d ago

Microsoft Azure Communication Phone Numbers client library for Python. Manage phone number resources, purchase, release, and search for phone numbers. Current version: 1.4.0. Released monthly with Azure SDK for Python.

pip install azure-communication-phonenumbers
INSTALL
IMPORT
SIG · AZURE-COMMUNICATIO
A
azure-communication-phonenumbers
azurepythonv1.4.0
Install
2.5s avg
Import
444ms
Disk
23MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.468s · 24.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.5s · import 0.420s · 25MB
23MB installed
● package 23MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PhoneNumbersClient
from azure.communication.phonenumbers import PhoneNumbersClient
from azure.communication import PhoneNumbersClient
Import path includes 'phonenumbers' subpackage.
PhoneNumberCapabilities
from azure.communication.phonenumbers import PhoneNumberCapabilities
from azure.communication.phonenumbers.models import PhoneNumberCapabilities
Capabilities is directly in the top-level module.

Initialize the client and list purchased phone numbers.

import os from azure.communication.phonenumbers import PhoneNumbersClient from azure.identity import DefaultAzureCredential endpoint = os.environ.get('COMMUNICATION_SERVICES_ENDPOINT', '') credential = DefaultAzureCredential() client = PhoneNumbersClient(endpoint, credential) # List purchased phone numbers purchased = client.list_purchased_phone_numbers() for pn in purchased: print(pn.phone_number)
Debug
Known issues
breakingVersion 1.4.0 drops support for Python <3.9.
fix
Upgrade Python to 3.9+.
affects: >=1.4.0
gotchaPhoneNumberCapabilities is imported directly from azure.communication.phonenumbers, not from a 'models' submodule.
fix
Use: from azure.communication.phonenumbers import PhoneNumberCapabilities
affects: all
gotchaThe 'phone_number' property returns a string with the '+' prefix (e.g., '+15551234567').
fix
Strip '+' if needed for E.164 comparison.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'PhoneNumbersClient' from 'azure.communication'
Incorrect import path; missing 'phonenumbers' subpackage.
fix
Use: from azure.communication.phonenumbers import PhoneNumbersClient
AttributeError: 'PhoneNumberCapabilities' object has no attribute 'sms'
Trying to access a capability that was not set; capabilities are optional and may be None.
fix
Check capability attribute for None before use: if cap.sms: ...
Upgrade
Version history
1.4.0latest on PyPI · released Aug 28, 2025
Audit
Dependencies
azure-corerequiredHTTP pipeline and authentication
azure-identityrequiredToken credential for authentication
Agent activity
38 hits · last 30 days
node
30
OpenAI (training)
1
Resources
azure-communication-phonenumbers — pip install azure-communication-phonenumbers · libregistry