Python example for submitting MMS message

Python example for submitting MMS message SearchSearch
Author Message
Patrick Chiang
New member
Username: Pychiang

Post Number: 1
Registered: 11-2013
Posted on Sunday, November 10, 2013 - 09:16 am:   

Hello,

In the manual, there are PHP, Java, VB, and C# examples of submitting MMS message to Now SMS/MMS Gateway. Is there a Python example available?

Thanks,
Patrick
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4735
Registered: 08-2008
Posted on Monday, November 11, 2013 - 04:41 pm:   

Hi Patrick,

We don't have any Python coding experience. But basically what the other examples are doing is constructing an HTTP file upload using MIME type multipart/form-data. This is the standard format that is used by a web form that allows files to be uploaded.

There is an example of the raw HTTP format here: http://www.nowsms.com/sending-mms-messages-with-nowsms

If you do a web search on Python multipart/form-data you'll find info on using different libraries to construct these types of requests. I did notice that one of the popular libraries is unable to mix data fields and files in the same post. If you refer to the raw example above, "PhoneNumber" for the recipient is a data field and "MMSFile" for the content is a file. NowSMS does allow you to mix HTTP GET style URL parameters with HTTP POST parameters ... so, if necessary, data field parameters could be specified in the URL request (i.e., &PhoneNumber=1234&MMSSubject=This+is+a+test) with the file parts in the POST part.

--
Des
NowSMS Support