Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Change Log
## [4.59.2](https://github.com/plivo/plivo-ruby/tree/v4.62.1) (2025-08-06)
**Feature - Expanded Media Type Support for Media Upload**
- Added support for additional media file formats: GIF, MP3, WAV, OGG, 3GPP, 3GPP2, VCARD, CSV, XLS, XLSX, and PLAIN text files

## [4.59.1](https://github.com/plivo/plivo-python/tree/v4.59.1) (2025-05-28)
- Fixed signature validation.

Expand Down
20 changes: 15 additions & 5 deletions plivo/resources/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,29 @@ def upload(self, media_file):
fileList = []
for media_url in media_file:
file_extension = media_url.strip().split('.')[-1].lower()
if file_extension not in ['jpeg', 'jpg', 'png', 'xcf', 'plain', 'pdf', 'mpeg', 'mp4']:
if file_extension not in ['jpeg', 'jpg', 'png', 'gif', 'mp3', 'mp4', 'mpeg', 'wav', 'ogg', '3gpp', '3gpp2', 'vcard', 'csv', 'pdf', 'xls', 'xlsx', 'xcf', 'plain']:
raise ValidationError(
'File format of the file to be uploaded should be one of JPG, JPEG, PNG or PDF'
'File format of the file to be uploaded should be one of JPG, JPEG, PNG, GIF, MP3, MP4, MPEG, WAV, OGG, 3GPP, 3GPP2, VCARD, CSV, PDF, XLS, XLSX, XCF, or TEXT'
)
content_types = {
'jpeg': 'image/jpeg',
'jpg': 'image/jpeg',
'png': 'image/png',
'gif': 'image/gif',
'mp3': 'audio/mp3',
'mp4': 'video/mp4',
'mpeg': 'audio/mpeg',
'wav': 'audio/wav',
'ogg': 'audio/ogg',
'3gpp': 'video/3gpp',
'3gpp2': 'video/3gpp2',
'vcard': 'text/vcard',
'csv': 'text/csv',
'pdf': 'application/pdf',
'xls': 'application/vnd.ms-excel',
'xlsx': 'application/vnd.ms-excel',
'xcf': 'image/xcf',
'text': 'text/plain',
'mpeg': 'video/mpeg',
'mp4': 'video/mp4'
'plain': 'text/plain'
}
print(media_url)
import os
Expand Down
2 changes: 1 addition & 1 deletion plivo/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
__version__ = '4.59.1'
__version__ = '4.59.2'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name='plivo',
version='4.59.1',
version='4.59.2',
description='A Python SDK to make voice calls & send SMS using Plivo and to generate Plivo XML',
long_description=long_description,
url='https://github.com/plivo/plivo-python',
Expand Down
Loading