Registry / communication / plivo

plivo

JSON →
library4.59.6pypypi✓ verified 50d ago

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.

communication
pip install plivo
Install & Compatibility
Where this runs
tested against v4.60.2 · 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.925 runs
installs and imports cleanly · install 0.0s · import 0.836s · 35.1MB
glibc
py 3.103.925 runs
installs and imports cleanly · install 2.9s · import 0.746s · 36MB
33MB installed
● package 33MB
Code
Verified usage

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

RestClient
from plivo import RestClient
import plivo

Send SMS, make a call, generate Plivo XML. Store credentials in env vars.

import plivo import os # Use env vars: PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN client = plivo.RestClient() # Send SMS sms = client.messages.create( src='+12025551234', # Your Plivo number in E.164 format dst='+14155551234', # Destination in E.164 format text='Hello from Plivo!' ) print('SMS sent:', sms) # Make a call call = client.calls.create( from_='+12025551234', to_='+14155551234', answer_url='https://yourapp.com/answer_url' # Returns Plivo XML ) print('Call made:', call) # Generate Plivo XML (for answer_url endpoint) from plivo import plivoxml xml = plivoxml.ResponseElement() xml.add(plivoxml.SpeakElement('Hello! This call is powered by Plivo.')) print(xml.to_string())
Debug
Known issues
breakingLegacy 0.11.3 (plivo.RestAPI) and current 4.x (plivo.RestClient) are completely different APIs. pip install --upgrade plivo from 0.11.3 may fail silently or leave a broken installation. All old code using RestAPI, send_message(), dict-based params will raise AttributeError on 4.x.
fix
Uninstall first: pip uninstall plivo, then pip install plivo. Rewrite all code from plivo.RestAPI pattern to plivo.RestClient pattern — they are not compatible.
affects: >= 4.0
breakingPhone numbers must be in E.164 format (+country_code + number). Passing numbers without the + prefix causes API errors. Common mistake: passing '12025551234' instead of '+12025551234'.
fix
Always use E.164 format: '+' + country_code + local_number. Example: +12025551234 for a US number, +919876543210 for an Indian number.
affects: all
gotchacalls.create() requires an answer_url that returns valid Plivo XML (ResponseElement). Passing an answer_url that returns JSON or empty response causes the call to fail silently after connecting.
fix
The answer_url endpoint must return Plivo XML with Content-Type: application/xml. Use plivoxml.ResponseElement() to generate the response.
affects: all
gotchaThe src number for SMS must be a Plivo-owned number in your account, not your personal number. Sending from an unverified or unowned number returns a 400 error.
fix
Purchase a Plivo number at console.plivo.com. The src parameter must match a number in your Plivo account.
affects: all
gotchaclient.messages.list() returns max 20 results by default. For pagination, use limit and offset parameters explicitly. There is no automatic pagination built into list().
fix
Use offset parameter: client.messages.list(limit=20, offset=20) for page 2. Or iterate manually while response has results.
affects: all
breakingThe Plivo Python SDK requires authentication credentials (PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN) to be set. These are typically read from environment variables or passed directly to the Plivo.RestClient() constructor. Failure to provide them will result in an AuthenticationError.
fix
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').
affects: all
breakingThe Plivo Python SDK failed to find authentication credentials. It attempts to read PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN from environment variables by default, or they must be passed explicitly to plivo.RestClient(). Failure to provide these results in plivo.exceptions.AuthenticationError and `KeyError: 'PLIVO_AUTH_ID'` or `'PLIVO_AUTH_TOKEN'`.
fix
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')`.
affects: all
Upgrade
Version history
4.60.2latest on PyPI
Audit
Dependencies
requestsrequiredRequired. Installed automatically.
pytzrequiredRequired. Installed automatically.
PyJWTrequiredRequired for JWT token creation. Installed automatically.
Agent activity
44 hits · last 30 days
node
10
seranking-bot
4
ahrefsbot
3
Meta
1
googlebot
1
Resources