Menu

Welcome to Help

Help
2007-06-11
2013-04-23
  • Nobody/Anonymous

    Welcome to Help

     
    • scmgre

      scmgre - 2007-12-11

      Hi are there any example of how to use the mms library? i want to send an MM1 message to my mmsc. any example of how to do this would be good.
      I'm using the following script i've written which doesn;t work because it doesn;t have the proper encapsulation x headers etcetra how would i use your mms lib in the same way?

      import urllib2
      from email.MIMEText import MIMEText

      req=urllib2.Request(url="http://10.141.24.25:10021/mmsc/01")
      req.add_header("msisdn","6799998772")
      req.add_header("Pragma",'no-cache')
      req.add_header('accept','text/css,application/vnd.wap.wmlscriptc,application/vnd.wap.wbxml,application/x-wap-prov.browser-settings,application/x-nokia.settings,text/x-vcard,text/x-vcalendar,application/vnd.wap.wtls-ca-certificate,application/vnd.wap.hashed-certificate,application/vnd.wap.signed-certificate,application/vnd.wap.cert-response,application/vnd.wap.sic,application/vnd.wap.slc,application/x-wap-prov.browser-bookmarks,text/html,application/vnd.wap.wmlc,application/xhtml+xml,application/vnd.wap.xhtml+xml,text/x-co-desc,application/vnd.oma.dd+xml,application/vnd.oma.drm.message,image/gif,image/jpeg,image/jpg,image/bmp,image/png,image/vnd.wap.wbmp,image/vnd.nok-wallpaper,audio/amr,audio/amr-wb,audio/midi,audio/mid,audio/x-midi,audio/x-mid,audio/sp-midi,application/vnd.nokia.ringing-tone,image/vnd-nok-camera-snap,image/vnd-nok-camera-snsp,text/vnd.sun.j2me.app-descriptor,application/vnd.oma.drm.content,application/java,application/vnd.oma.drm.rights+xml,image/vnd.nok-oplogo-color,application/java-archive,application/vnd.oma.drm.rights+wbxml,application/x-java-archive,x-obex/file,x-obex/folder-listing,application/vnd.wap.mms-message,text/vnd.wap.wml,text/vnd.wap.wmlscript,*/*;q=0.001')
      req.add_header('accept-encoding','*;q=0.001')
      req.add_header('accept-charset','iso-8859-1,utf-8;q=0.800,us-ascii;q=0.700,iso-10646-ucs-2;q=0.600,*;q=0.001')
      req.add_header('accept-language','en')
      data="777777/TYPE=PLMN"
      txt="this is a test message"
      msg=MIMEText(txt)
      msg['Subject'] = 'test message'
      msg['From'] = "6799998772/TYPE=PLMN"
      msg["To"] = "777777/TYPE=PLMN"
      print msg.as_string()
      opener = urllib2.build_opener()
      opener.addheaders = [('User-agent', 'MOT-V1050/83.38.49I MIB/2.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.1'),('Content-Type','application/vnd.wap.mms-message')]
      f=opener.open(req,msg.as_string())
      print f.read()
      ~

       
    • scmgre

      scmgre - 2007-12-12

      sorted i unpacked the code and the examples were there.

      import urllib2
      import mms

      req=urllib2.Request(url="http://10.141.24.25:10021/mmsc/01")
      req.add_header("msisdn","6799998772")
      req.add_header("Pragma",'no-cache')
      req.add_header('accept','text/css,application/vnd.wap.wmlscriptc,application/vnd.wap.wbxml,application/x-wap-prov.browser-settings,application/x-nokia.settings,text/x-vcard,text/x-vcalendar,application/vnd.wap.wtls-ca-certificate,application/vnd.wap.hashed-certificate,application/vnd.wap.signed-certificate,application/vnd.wap.cert-response,application/vnd.wap.sic,application/vnd.wap.slc,application/x-wap-prov.browser-bookmarks,text/html,application/vnd.wap.wmlc,application/xhtml+xml,application/vnd.wap.xhtml+xml,text/x-co-desc,application/vnd.oma.dd+xml,application/vnd.oma.drm.message,image/gif,image/jpeg,image/jpg,image/bmp,image/png,image/vnd.wap.wbmp,image/vnd.nok-wallpaper,audio/amr,audio/amr-wb,audio/midi,audio/mid,audio/x-midi,audio/x-mid,audio/sp-midi,application/vnd.nokia.ringing-tone,image/vnd-nok-camera-snap,image/vnd-nok-camera-snsp,text/vnd.sun.j2me.app-descriptor,application/vnd.oma.drm.content,application/java,application/vnd.oma.drm.rights+xml,image/vnd.nok-oplogo-color,application/java-archive,application/vnd.oma.drm.rights+wbxml,application/x-java-archive,x-obex/file,x-obex/folder-listing,application/vnd.wap.mms-message,text/vnd.wap.wml,text/vnd.wap.wmlscript,*/*;q=0.001')
      req.add_header('accept-encoding','*;q=0.001')
      req.add_header('accept-charset','iso-8859-1,utf-8;q=0.800,us-ascii;q=0.700,iso-10646-ucs-2;q=0.600,*;q=0.001')
      req.add_header('accept-language','en')
      req.add_header('Content-type','application/vnd.wap.mms-message')
      slide1 = mms.MMSMessagePage()
      slide1.addImage('python-mms-0.2/examples/content/pymms.jpg')
      slide1.addText('This is the first slide, with a static image and some text.')
      message = mms.MMSMessage()
      message.headers['Subject'] = 'Test MMS'
      message.headers['To'] = "777777" + '/TYPE=PLMN'
      message.headers['From'] = "6799998772" + '/TYPE=PLMN'
      message.addPage(slide1)
          # ...and finally, save the message to disk

      opener = urllib2.build_opener()
      #opener.addheaders = [('Content-type','application/vnd.wap.mms-message')]
      opener.addheaders = [('User-agent', 'MOT-V1050/83.38.49I MIB/2.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.1'),('Content-type','application/vnd.wap.mms-message')]
      f=opener.open(req,message.encode())
      n= f.read()
      a=open("rep.out","w")
      a.write(n)
      a.close()

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.