Python SDK for Plivo communications API — SMS, voice calls, WhatsApp, and Plivo XML generation. Current version is 4.59.6. Legacy version 0.11.3 has a completely different API (plivo.RestAPI vs plivo.RestClient). pip install --upgrade plivo may NOT cleanly upgrade from legacy — manual uninstall required.
pip install plivoVerified import paths — ran on the pinned version, not inferred.
Send SMS, make a call, generate Plivo XML. Store credentials in env vars.
Uninstall first: pip uninstall plivo, then pip install plivo. Rewrite all code from plivo.RestAPI pattern to plivo.RestClient pattern — they are not compatible.
Always use E.164 format: '+' + country_code + local_number. Example: +12025551234 for a US number, +919876543210 for an Indian number.
The answer_url endpoint must return Plivo XML with Content-Type: application/xml. Use plivoxml.ResponseElement() to generate the response.
Purchase a Plivo number at console.plivo.com. The src parameter must match a number in your Plivo account.
Use offset parameter: client.messages.list(limit=20, offset=20) for page 2. Or iterate manually while response has results.
Set the PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN environment variables before running your script. Alternatively, pass auth_id and auth_token directly to the Plivo.RestClient() constructor: client = plivo.RestClient(auth_id='YOUR_AUTH_ID', auth_token='YOUR_AUTH_TOKEN').
Ensure PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN environment variables are set before running the application, or initialize the client with `client = plivo.RestClient(auth_id='YOUR_AUTH_ID', auth_token='YOUR_AUTH_TOKEN')`.