devalexanderdaza / yowsapp-framework

Yowsaapp Framework
15 stars 2 forks source link

Not able to send images #28

Open MHilhorst opened 5 years ago

MHilhorst commented 5 years ago

Hello firstly lovely repo that makes this work!

When im trying to send an image I get the following error:

E 2019-06-07 19:34:24,619 yowsup.layers.network.dispatcher.dispatcher_asyncore - Traceback (most recent call last): File "/usr/lib/python3.6/asyncore.py", line 83, in read obj.handle_read_event() File "/usr/lib/python3.6/asyncore.py", line 423, in handle_read_event self.handle_read() File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/network/dispatcher/dispatcher_asyncore.py", line 48, in handle_read self.connectionCallbacks.onRecvData(data) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/network/layer.py", line 100, in onRecvData self.receive(data) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/network/layer.py", line 103, in receive self.toUpper(data) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/noise/layer_noise_segments.py", line 39, in receive self.toUpper(bytes(data)) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/noise/layer.py", line 156, in receive self._flush_incoming_buffer() File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/noise/layer.py", line 144, in _flush_incoming_buffer self.toUpper(self._wa_noiseprotocol.receive()) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/coder/layer.py", line 21, in receive self.toUpper(node) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/logger/layer.py", line 14, in receive self.toUpper(data) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/axolotl/layer_control.py", line 35, in receive self.toUpper(protocolTreeNode) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/init__.py", line 194, in receive s.receive(data) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/axolotl/layer_receive.py", line 34, in receive self.toUpper(protocolTreeNode) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/init.py", line 194, in receive s.receive(data) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/init.py", line 126, in receive if not self.processIqRegistry(node): File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/init.py", line 161, in processIqRegistry successClbk(protocolTreeNode, originalIq) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/protocol_media/layer.py", line 74, in onRequestUploadSuccess self.toUpper(ResultRequestUploadIqProtocolEntity.fromProtocolTreeNode(resultNode)) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/interface/interface.py", line 77, in receive if not self.processIqRegistry(entity): File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/interface/interface.py", line 56, in processIqRegistry successClbk(entity, originalIq) File "/home/wapp/yowsapp-framework/app/mac/mac.py", line 191, in caption) File "/home/wapp/yowsapp-framework/app/mac/mac.py", line 278, in on_request_upload_result True) File "/usr/local/lib/python3.6/dist-packages/yowsup/layers/protocol_media/mediauploader.py", line 18, in init WARequest.init(self) TypeError: init__() missing 1 required positional argument: 'config' b

I am using latest version, with Ubuntu 18.04

path = app/assets/images/1.png

Does anyone knows how to fix this issue?

x-frst commented 5 years ago

Media sending is not implemented yet, please wait he'll soon implement that feature!

Sharissa90 commented 5 years ago

WARequest need config arguments, you can pull config and add as argument like this in your /usr/local/lib/python3.6/dist-packages/yowsup/layers/protocol_media/mediauploader.py

from yowsup.config.manager import ConfigManager
from yowsup.profile.profile import YowProfile

logger = logging.getLogger(__name__)

class MediaUploader(WARequest, threading.Thread):
    def __init__(self, jid, accountJid, sourcePath, uploadUrl, resumeOffset = 0, successClbk = None, errorClbk = None, progressCallback = None, asynchronous=True):
        self._config_manager = ConfigManager()
        myAcc = accountJid.split('@')
        config = self._config_manager.load(myAcc[0])
        WARequest.__init__(self, YowProfile(config.phone))
MHilhorst commented 5 years ago

WARequest need config arguments, you can pull config and add as argument like this in your /usr/local/lib/python3.6/dist-packages/yowsup/layers/protocol_media/mediauploader.py

from yowsup.config.manager import ConfigManager
from yowsup.profile.profile import YowProfile

logger = logging.getLogger(__name__)

class MediaUploader(WARequest, threading.Thread):
    def __init__(self, jid, accountJid, sourcePath, uploadUrl, resumeOffset = 0, successClbk = None, errorClbk = None, progressCallback = None, asynchronous=True):
        self._config_manager = ConfigManager()
        myAcc = accountJid.split('@')
        config = self._config_manager.load(myAcc[0])
        WARequest.__init__(self, YowProfile(config.phone))

THank you for your response, this is a good way to fix some errors. However, i believe you dont need (YowProfile(config.phone)

instead you just use

WARequest.__init__(self,config)

It will give a new error that is related to Errno 104 yowsup

Sharissa90 commented 5 years ago

@MHilhorst I dont know if this framework use latest source from yowsup master branch or not, but I notice yowsup will use YowProfile https://github.com/tgalal/yowsup/commit/2780c02280ecca87b139f2233ece8b19027d0c78 and if this framework update yowsup source i believe you must use

YowProfile(config.phone)
devalexanderdaza commented 5 years ago

This functionality is already identified, but I have not had the time to implement it. Between today or tomorrow I will implement it. Keep in mind that this version is ready to always use the latest version of Yowsup. Soon I will have news for you. A greeting!

MHilhorst commented 5 years ago

Thank you very much deval, that is great to hear. Love using this framework!

eduardocalazansjr commented 5 years ago

Image and generic media send just doesn't work in yowsup. Nothin' to do in yowsapp side, yet.

jesusvalverde commented 5 years ago

any news over the image issue ?

devalexanderdaza commented 5 years ago

@jesusvalverde I'm working on this right now