v20 -> v21
UUID Support
The SDK now respects fields defined as uuid as instances of the UUID class from the standard library instead of strings.
- v20
- v21
# Example from the VerificationWebhook model
from bandwidth.models.verification_webhook import VerificationWebhook
webhook = VerificationWebhook(
account_id = '1234567',
phone_number = '+18005555555',
status = 'VERIFIED',
internal_ticket_number = 'acde070d-8c4c-4f0d-9d8a-162843c10333'
)
# Example from the VerificationWebhook model
from bandwidth.models.verification_webhook import VerificationWebhook
webhook = VerificationWebhook(
account_id = '1234567',
phone_number = '+18005555555',
status = 'VERIFIED',
internal_ticket_number = UUID('acde070d-8c4c-4f0d-9d8a-162843c10333')
)
Phone Number Lookup
We've updated the phone number lookup methods to use our new V2 API (found here). This API supports both Synchronous and Asynchronous lookups. See the code samples below for how to implement each type of lookup.
- v20
- v21
configuration = Configuration()
api_client = ApiClient(configuration)
api = PhoneNumberLookupApi(api_client)
phone_numbers = [os.environ['BW_NUMBER']]
account_id = os.environ['BW_ACCOUNT_ID']
lookup_request = LookupRequest(tns=phone_numbers)
create_lookup_response: CreateLookupResponse = api.create_lookup(account_id, lookup_request)
get_lookup_status_response: LookupStatus = api.get_lookup_status(
account_id,
create_lookup_response.request_id
)
configuration = Configuration()
api_client = ApiClient(configuration)
api = PhoneNumberLookupApi(api_client)
phone_numbers = [os.environ['BW_NUMBER']]
account_id = os.environ['BW_ACCOUNT_ID']
request = AsyncLookupRequest(phone_numbers=phone_numbers)
create_response = api.create_async_bulk_lookup_with_http_info(account_id, request)
request_id = create_response.data.data.request_id
get_response = api.get_async_bulk_lookup_with_http_info(account_id, request_id)
# Or use the new synchronous lookup method
request = SyncLookupRequest(phone_numbers=phone_numbers)
response = api.create_sync_lookup_with_http_info(BW_ACCOUNT_ID, request)