def _do_send_file(self, media_path, url, to, ip=None, caption=None):
     """
         Now the media file has been uploaded and the whatsapp server returns a media_path.
         The media_path is then sent to the receipt.
     """
     entity = None
     if self.MEDIA_TYPE == DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_VIDEO:
         entity = VideoDownloadableMediaMessageProtocolEntity.fromFilePath(media_path, url, self.MEDIA_TYPE, ip, to)
     elif self.MEDIA_TYPE == DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_IMAGE:
         entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(media_path, url, ip, to, caption=caption)
     self.interface_layer.toLower(entity)
Exemplo n.º 2
0
 def _do_send_file(self, file_path, url, to, ip=None, caption=None):
     """
         Now the media file has been uploaded and the whatsapp server returns a media_path.
         The media_path is then sent to the receipt.
     """
     entity = None
     if self.MEDIA_TYPE == DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_VIDEO:
         entity = VideoDownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, self.MEDIA_TYPE, ip, to)
     elif self.MEDIA_TYPE == DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_IMAGE:
         entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, ip, to, caption=caption)
     elif self.MEDIA_TYPE == DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_AUDIO:
         entity = AudioDownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, ip, to)
     self.interface_layer.toLower(entity)