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)
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)
def image_downloadable_media_message_protocol_entity(url="url", to="341234567", ip="ip", caption="image caption"): attributes = { "mimeType": DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_IMAGE, "fileHash": "filehash", "url": url, "ip": ip, "size": "1234", "fileName": "image.jpg", "encoding": "encoding", "width": "123", "height": "123", "caption": caption, "to": to } return ImageDownloadableMediaMessageProtocolEntity(**attributes)
def do_send_image(self, file_path, url, to, ip=None, caption=None): entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath( file_path, url, ip, to, caption=caption) self.toLower(entity)
def do_send_image(self, file_path, url, to, ip=None, caption=None): entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, ip, to, caption=caption) self.toLower(entity)
def doSendImage(self, filePath, url, to, ip=None, caption=None): print("sending image") entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath( filePath, url, ip, to, caption=caption) self.toLower(entity)