{"id":23326,"library":"azure-communication-phonenumbers","title":"Azure Communication Phone Numbers","description":"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.","status":"active","version":"1.4.0","language":"python","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python","tags":["azure","communication","phone-numbers","pstn"],"install":[{"cmd":"pip install azure-communication-phonenumbers","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"HTTP pipeline and authentication","package":"azure-core","optional":false},{"reason":"Token credential for authentication","package":"azure-identity","optional":false}],"imports":[{"note":"Import path includes 'phonenumbers' subpackage.","wrong":"from azure.communication import PhoneNumbersClient","symbol":"PhoneNumbersClient","correct":"from azure.communication.phonenumbers import PhoneNumbersClient"},{"note":"Capabilities is directly in the top-level module.","wrong":"from azure.communication.phonenumbers.models import PhoneNumberCapabilities","symbol":"PhoneNumberCapabilities","correct":"from azure.communication.phonenumbers import PhoneNumberCapabilities"}],"quickstart":{"code":"import os\nfrom azure.communication.phonenumbers import PhoneNumbersClient\nfrom azure.identity import DefaultAzureCredential\n\nendpoint = os.environ.get('COMMUNICATION_SERVICES_ENDPOINT', '')\ncredential = DefaultAzureCredential()\nclient = PhoneNumbersClient(endpoint, credential)\n\n# List purchased phone numbers\npurchased = client.list_purchased_phone_numbers()\nfor pn in purchased:\n    print(pn.phone_number)","lang":"python","description":"Initialize the client and list purchased phone numbers."},"warnings":[{"fix":"Upgrade Python to 3.9+.","message":"Version 1.4.0 drops support for Python <3.9.","severity":"breaking","affected_versions":">=1.4.0"},{"fix":"Use: from azure.communication.phonenumbers import PhoneNumberCapabilities","message":"PhoneNumberCapabilities is imported directly from azure.communication.phonenumbers, not from a 'models' submodule.","severity":"gotcha","affected_versions":"all"},{"fix":"Strip '+' if needed for E.164 comparison.","message":"The 'phone_number' property returns a string with the '+' prefix (e.g., '+15551234567').","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: from azure.communication.phonenumbers import PhoneNumbersClient","cause":"Incorrect import path; missing 'phonenumbers' subpackage.","error":"ImportError: cannot import name 'PhoneNumbersClient' from 'azure.communication'"},{"fix":"Check capability attribute for None before use: if cap.sms: ...","cause":"Trying to access a capability that was not set; capabilities are optional and may be None.","error":"AttributeError: 'PhoneNumberCapabilities' object has no attribute 'sms'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}